TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ruby DATA

45 点作者 EzGraphs超过 12 年前

4 条评论

edward超过 12 年前
This is copied from Perl. See <a href="http://stackoverflow.com/questions/161872/hidden-features-of-perl#163700" rel="nofollow">http://stackoverflow.com/questions/161872/hidden-features-of...</a><p><pre><code> my @lines = &#60;DATA&#62;; for (@lines) { print if /bad/; } __DATA__ some good data some bad data more good data more good data</code></pre>
评论 #5031661 未加载
评论 #5032586 未加载
评论 #5031644 未加载
评论 #5032319 未加载
lukeholder超过 12 年前
I learnt about this a while back when sinatra was released, you could have your html template in the same file. great idea for a micro framework.
评论 #5032354 未加载
评论 #5031639 未加载
stevekemp超过 12 年前
I wrote a static-site generator, and I wanted to be able to allow users to deploy new instances easily.<p>To do that I wrote some code that parses a __DATA__ block for lines like:<p>mkdir foo create_file foo/bar.txt &#60;&#60;EOF .. This is the file content .. EOF mkdir bar ..<p>The process was very simple and allowed me to bundle up the "master template" files in one simple to understand resource.<p>[1] - <a href="https://github.com/skx/templer" rel="nofollow">https://github.com/skx/templer</a> [2] - <a href="https://raw.github.com/skx/templer/master/lib/Templer/Site/New.pm" rel="nofollow">https://raw.github.com/skx/templer/master/lib/Templer/Site/N...</a>
评论 #5031647 未加载
tragomaskhalos超过 12 年前
I had thought that the ability to do a simple quine by rewinding DATA was some weird implementation bug, so nice to see the rationale here !