hn 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Forrest Ye
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ # Hn
2
+
3
+ A tiny gem to fetch Hacker News entries
4
+
5
+ ![hn gem](http://forresty.com/images/hn.png)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'hn'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ ## Usage
18
+
19
+ require 'hn'
20
+
21
+ # return 30 homepage entries
22
+ HackerNews::Engine.homepage
23
+
24
+ # return 30 newest entries
25
+ HackerNews::Engine.newest
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ end
9
+
10
+ task :default => :spec
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/hn/version', __FILE__)
3
+ require File.expand_path('../lib/hn/common', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.authors = ["Forrest Ye"]
7
+ gem.email = ["afu@forresty.com"]
8
+ gem.description = HackerNews::DESCRIPTION
9
+ gem.summary = HackerNews::DESCRIPTION
10
+ gem.homepage = "https://github.com/forresty/hn"
11
+
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.name = "hn"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = HackerNews::VERSION
18
+
19
+ gem.add_development_dependency 'rspec'
20
+ gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'simplecov'
22
+ gem.add_development_dependency 'chronic'
23
+
24
+ gem.add_runtime_dependency 'nokogiri'
25
+ end
@@ -0,0 +1,5 @@
1
+ require "hn/version"
2
+ require "hn/common"
3
+ require "hn/models/entry"
4
+ require "hn/parsers/entry_parser"
5
+ require "hn/engine"
@@ -0,0 +1,3 @@
1
+ module HackerNews
2
+ DESCRIPTION = "A tiny gem to fetch Hacker News entries"
3
+ end
@@ -0,0 +1,13 @@
1
+ module HackerNews
2
+ class Engine
3
+ class << self
4
+ def homepage
5
+ EntryParser.new.homepage
6
+ end
7
+
8
+ def newest
9
+ EntryParser.new.newest
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module HackerNews
2
+ class Entry
3
+ attr_accessor :id, :title, :link, :site, :points, :num_comments, :time_string, :user
4
+
5
+ def initialize
6
+ yield self if block_given?
7
+ self
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ require "nokogiri"
2
+ require "open-uri"
3
+
4
+ module HackerNews
5
+ class EntryParser
6
+ def homepage
7
+ parse_entries 'http://news.ycombinator.com/'
8
+ end
9
+
10
+ def newest
11
+ parse_entries 'http://news.ycombinator.com/newest'
12
+ end
13
+
14
+ private
15
+
16
+ def parse_entries(url)
17
+ # doc = Nokogiri::HTML(open('spec/fixtures/home.html'))
18
+ doc = Nokogiri::HTML(open(url))
19
+ tbody = doc.at_css('td.title').parent.parent
20
+ trs = tbody.css('tr').to_a
21
+
22
+ 30.times.map do |i|
23
+ Entry.new do |entry|
24
+ entry.title = trs[i*3].at_css('td.title a').text
25
+ entry.link = trs[i*3].at_css('td.title a')['href']
26
+ entry.site = trs[i*3].at_css('td.title span.comhead').text.match(/\((.+)\)/)[1] rescue nil
27
+ entry.points = trs[i*3+1].at_css('td.subtext span').text.to_i rescue 0
28
+ entry.user = trs[i*3+1].at_css('td.subtext a').text
29
+ entry.time_string = trs[i*3+1].at_css('td.subtext a').next.text.sub('|', '').strip
30
+ entry.num_comments = trs[i*3+1].css('td.subtext a')[1].text.to_i
31
+ entry.id = trs[i*3+1].css('td.subtext a')[1]['href'].match(/\d+/)[0].to_i
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module HackerNews
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,24 @@
1
+ <html><head><link rel="stylesheet" type="text/css" href="http://ycombinator.com/news.css">
2
+ <link rel="shortcut icon" href="http://ycombinator.com/favicon.ico">
3
+ <script>
4
+ function byId(id) {
5
+ return document.getElementById(id);
6
+ }
7
+
8
+ function vote(node) {
9
+ var v = node.id.split(/_/); // {'up', '123'}
10
+ var item = v[1];
11
+
12
+ // hide arrows
13
+ byId('up_' + item).style.visibility = 'hidden';
14
+ byId('down_' + item).style.visibility = 'hidden';
15
+
16
+ // ping server
17
+ var ping = new Image();
18
+ ping.src = node.href;
19
+
20
+ return false; // cancel browser nav
21
+ } </script><title>Hacker News</title></head><body><center><table border=0 cellpadding=0 cellspacing=0 width="85%" bgcolor=#f6f6ef><tr><td bgcolor=#ff6600><table border=0 cellpadding=0 cellspacing=0 width="100%" style="padding:2px"><tr><td style="width:18px;padding-right:4px"><a href="http://ycombinator.com"><img src="http://ycombinator.com/images/y18.gif" width=18 height=18 style="border:1px #ffffff solid;"></img></a></td><td style="line-height:12pt; height:10px;"><span class="pagetop"><b><a href="news">Hacker News</a></b><img src="http://ycombinator.com/images/s.gif" height=1 width=10><a href="newest">new</a> | <a href="newcomments">comments</a> | <a href="ask">ask</a> | <a href="jobs">jobs</a> | <a href="submit">submit</a></span></td><td style="text-align:right;padding-right:4px;"><span class="pagetop"><a href="newslogin?whence=%6e%65%77%73">login</a></span></td></tr></table></td></tr><tr style="height:10px"></tr><tr><td><table border=0 cellpadding=0 cellspacing=0><tr><td align=right valign=top class="title">1.</td><td><center><a id=up_4030746 href="vote?for=4030746&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030746></span></center></td><td class="title"><a href="http://www.cl.cam.ac.uk/~sps32/sec_news.html#Assurance">Backdoor found in a China-made US military chip </a><span class="comhead"> (cam.ac.uk) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030746>392 points</span> by <a href="user?id=turnersr">turnersr</a> 10 hours ago | <a href="item?id=4030746">109 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">2.</td><td><center><a id=up_4031595 href="vote?for=4031595&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031595></span></center></td><td class="title"><a href="http://patdryburgh.com/blog/buying-adobe-photoshop-cs6/">Buying Adobe Photoshop CS6</a><span class="comhead"> (patdryburgh.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031595>63 points</span> by <a href="user?id=petercooper">petercooper</a> 4 hours ago | <a href="item?id=4031595">32 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">3.</td><td><center><a id=up_4032030 href="vote?for=4032030&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032030></span></center></td><td class="title"><a href="http://www.newyorker.com/reporting/2012/06/04/120604fa_fact_gibson?currentPage=all">William Gibson: Seeing the Future in Science Fiction</a><span class="comhead"> (newyorker.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032030>9 points</span> by <a href="user?id=jseliger">jseliger</a> 51 minutes ago | <a href="item?id=4032030">1 comment</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">4.</td><td><center><a id=up_4031157 href="vote?for=4031157&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031157></span></center></td><td class="title"><a href="http://www.mobileinc.co.uk/2012/05/the-art-of-the-ios-icon/">The Art Of The iOS Icon</a><span class="comhead"> (mobileinc.co.uk) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031157>126 points</span> by <a href="user?id=muratmutlu">muratmutlu</a> 7 hours ago | <a href="item?id=4031157">35 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">5.</td><td><center><a id=up_4031682 href="vote?for=4031682&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031682></span></center></td><td class="title"><a href="http://www.forbes.com/sites/haydnshaughnessy/2012/05/26/why-crisis-in-spain-this-week-should-have-us-more-worried-than-greece/">Why Crisis in Spain This Week Became More Important Than Greece</a><span class="comhead"> (forbes.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031682>53 points</span> by <a href="user?id=Flemlord">Flemlord</a> 3 hours ago | <a href="item?id=4031682">17 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">6.</td><td><center><a id=up_4031812 href="vote?for=4031812&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031812></span></center></td><td class="title"><a href="http://jasonlefkowitz.net/2012/05/windows-live-is-dead/">Windows Live is dead</a><span class="comhead"> (jasonlefkowitz.net) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031812>20 points</span> by <a href="user?id=smacktoward">smacktoward</a> 2 hours ago | <a href="item?id=4031812">6 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">7.</td><td><center><a id=up_4031639 href="vote?for=4031639&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031639></span></center></td><td class="title"><a href="http://www.forbes.com/sites/philjohnson/2012/05/10/the-man-who-took-on-amazon-and-saved-a-bookstore/">The Man Who Took on Amazon and Saved a Bookstore</a><span class="comhead"> (forbes.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031639>30 points</span> by <a href="user?id=wyclif">wyclif</a> 4 hours ago | <a href="item?id=4031639">9 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">8.</td><td><center><a id=up_4031739 href="vote?for=4031739&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031739></span></center></td><td class="title"><a href="http://www.bostonglobe.com/opinion/2012/05/26/boston-bar-buzz-kill/KbPYBLYiTjLsykcpPi0mRJ/story.html">Boston Bar Buzz-Kill</a><span class="comhead"> (bostonglobe.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031739>22 points</span> by <a href="user?id=ryanwjackson">ryanwjackson</a> 3 hours ago | <a href="item?id=4031739">4 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">9.</td><td><center><a id=up_4030149 href="vote?for=4030149&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030149></span></center></td><td class="title"><a href="http://musicthing.blogspot.co.uk/2005/05/tiny-music-makers-pt-3-thx-sound.html">The THX Sound</a><span class="comhead"> (blogspot.co.uk) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030149>251 points</span> by <a href="user?id=harel">harel</a> 15 hours ago | <a href="item?id=4030149">34 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">10.</td><td><center><a id=up_4031241 href="vote?for=4031241&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031241></span></center></td><td class="title"><a href="https://www.eff.org/deeplinks/2012/05/megaupload-user-asks-court-files-back-again">Megaupload User Asks Court for Files Back. Again.</a><span class="comhead"> (eff.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031241>57 points</span> by <a href="user?id=bond">bond</a> 7 hours ago | <a href="item?id=4031241">12 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">11.</td><td><center><a id=up_4030884 href="vote?for=4030884&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030884></span></center></td><td class="title"><a href="http://www.etherealbits.com/?p=68">The Software Developer’s Guide to Fitness & Morning Productivity</a><span class="comhead"> (etherealbits.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030884>84 points</span> by <a href="user?id=tysont">tysont</a> 9 hours ago | <a href="item?id=4030884">32 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">12.</td><td><center><a id=up_4031225 href="vote?for=4031225&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031225></span></center></td><td class="title"><a href="http://www.nytimes.com/2012/05/28/technology/for-tech-startups-new-york-has-increasing-allure.html?pagewanted=all">For Tech Start-Ups, New York Has Increasing Allure</a><span class="comhead"> (nytimes.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031225>51 points</span> by <a href="user?id=mindblink">mindblink</a> 7 hours ago | <a href="item?id=4031225">19 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">13.</td><td><center><a id=up_4030812 href="vote?for=4030812&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030812></span></center></td><td class="title"><a href="http://web.stonehill.edu/compsci//History_Math/math-read.htm">How to Read Mathematics</a><span class="comhead"> (stonehill.edu) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030812>96 points</span> by <a href="user?id=espeed">espeed</a> 10 hours ago | <a href="item?id=4030812">17 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">14.</td><td><center><a id=up_4031912 href="vote?for=4031912&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031912></span></center></td><td class="title"><a href="http://www.washingtonpost.com/world/the_americas/center-of-gravity-in-oil-world-shifts-to-americas/2012/05/25/gJQAjeuVqU_story.html">Center of gravity in oil world shifts to Americas </a><span class="comhead"> (washingtonpost.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031912>12 points</span> by <a href="user?id=cwan">cwan</a> 1 hour ago | <a href="item?id=4031912">4 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">15.</td><td><center><a id=up_4030816 href="vote?for=4030816&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030816></span></center></td><td class="title"><a href="http://www.websocket.org/quantum.html">How WebSockets work vs polling/long polling/streaming</a><span class="comhead"> (websocket.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030816>75 points</span> by <a href="user?id=SkyMarshal">SkyMarshal</a> 10 hours ago | <a href="item?id=4030816">27 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">16.</td><td><center><a id=up_4031608 href="vote?for=4031608&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031608></span></center></td><td class="title"><a href="http://lists.fedoraproject.org/pipermail/devel-announce/2012-May/000933.html">Fedora 17 Final declared Gold</a><span class="comhead"> (fedoraproject.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031608>21 points</span> by <a href="user?id=mindcrime">mindcrime</a> 4 hours ago | <a href="item?id=4031608">4 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">17.</td><td><center><a id=up_4031866 href="vote?for=4031866&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031866></span></center></td><td class="title"><a href="http://chat.techcentroid.com/" rel="nofollow">Open Source Chat Server in Node.js with dynamic rooms</a><span class="comhead"> (techcentroid.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031866>6 points</span> by <a href="user?id=mlakkadshaw">mlakkadshaw</a> 1 hour ago | <a href="item?id=4031866">6 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">18.</td><td><center><a id=up_4031007 href="vote?for=4031007&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031007></span></center></td><td class="title"><a href="http://mewo2.github.com/nerdery/2012/05/27/eurovision-statistics-after-the-final/">Eurovision statistics analysis, and an apology to the people of Malta</a><span class="comhead"> (github.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031007>38 points</span> by <a href="user?id=mewo2">mewo2</a> 8 hours ago | <a href="item?id=4031007">8 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">19.</td><td><center><a id=up_4031004 href="vote?for=4031004&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031004></span></center></td><td class="title"><a href="http://blog.gaborcselle.com/2012/05/eight-emotions-every-user-enjoys.html">Emotions Every User Enjoys</a><span class="comhead"> (gaborcselle.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031004>35 points</span> by <a href="user?id=admp">admp</a> 8 hours ago | <a href="item?id=4031004">2 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">20.</td><td><center><a id=up_4031699 href="vote?for=4031699&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031699></span></center></td><td class="title"><a href="https://github.com/aseemk/json5">Show HN: JSON5 — modern JSON</a><span class="comhead"> (github.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031699>36 points</span> by <a href="user?id=aseemk">aseemk</a> 3 hours ago | <a href="item?id=4031699">55 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">21.</td><td><center><a id=up_4030665 href="vote?for=4030665&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030665></span></center></td><td class="title"><a href="http://techcrunch.com/2012/05/27/hey-kids-get-off-my-lawn-the-once-and-future-visual-programming-environment/">The Once and Future Visual Programming Environment</a><span class="comhead"> (techcrunch.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030665>54 points</span> by <a href="user?id=NelsonMinar">NelsonMinar</a> 11 hours ago | <a href="item?id=4030665">32 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">22.</td><td><center><a id=up_4031129 href="vote?for=4031129&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031129></span></center></td><td class="title"><a href="http://nicholasjacob.com/Javascript/2012/05/27/oauth--websockets-avoiding-the-redirect/">OAuth & One-Page Apps: Avoiding the Redirect</a><span class="comhead"> (nicholasjacob.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031129>27 points</span> by <a href="user?id=chucknibbleston">chucknibbleston</a> 8 hours ago | <a href="item?id=4031129">8 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">23.</td><td><center><a id=up_4031163 href="vote?for=4031163&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031163></span></center></td><td class="title"><a href="http://www.neowin.net/news/rim-rumored-to-lay-off-2000-more-workers-soon">RIM rumored to lay off 2,000 more workers soon</a><span class="comhead"> (neowin.net) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031163>24 points</span> by <a href="user?id=xtiy">xtiy</a> 7 hours ago | <a href="item?id=4031163">20 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">24.</td><td><center><a id=up_4030035 href="vote?for=4030035&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030035></span></center></td><td class="title"><a href="http://blog.hashtagify.me/2012/05/27/save-time-on-hacker-neww-mark-all-read/">Save Time On Hacker News: Mark All Read</a><span class="comhead"> (hashtagify.me) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030035>90 points</span> by <a href="user?id=danmaz74">danmaz74</a> 16 hours ago | <a href="item?id=4030035">56 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">25.</td><td><center><a id=up_4030689 href="vote?for=4030689&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030689></span></center></td><td class="title"><a href="http://visualwebsiteoptimizer.com/split-testing-blog/you-should-not-follow-me-on-twitter/">You should not follow me on Twitter</a><span class="comhead"> (visualwebsiteoptimizer.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030689>53 points</span> by <a href="user?id=paulgb">paulgb</a> 11 hours ago | <a href="item?id=4030689">18 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">26.</td><td><center><a id=up_4030033 href="vote?for=4030033&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030033></span></center></td><td class="title"><a href="http://blog.jerodsanto.net/2012/05/back-that-gmail-up/">Back That Gmail Up</a><span class="comhead"> (jerodsanto.net) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030033>81 points</span> by <a href="user?id=sant0sk1">sant0sk1</a> 16 hours ago | <a href="item?id=4030033">53 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">27.</td><td><center><a id=up_4030868 href="vote?for=4030868&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030868></span></center></td><td class="title"><a href="item?id=4030868">Remind HN: If you want feedback, add an email to your profile</a></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030868>85 points</span> by <a href="user?id=ekpyrotic">ekpyrotic</a> 10 hours ago | <a href="item?id=4030868">27 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">28.</td><td><center><a id=up_4030451 href="vote?for=4030451&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030451></span></center></td><td class="title"><a href="http://www.twilio.com/company/nine-values">Twilio's Nine Values</a><span class="comhead"> (twilio.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030451>62 points</span> by <a href="user?id=sunils34">sunils34</a> 13 hours ago | <a href="item?id=4030451">15 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">29.</td><td><center><a id=up_4030061 href="vote?for=4030061&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4030061></span></center></td><td class="title"><a href="http://blogs.adobe.com/digitalmarketing/personalization/conversion-optimization/understand-the-math-behind-it-all-bayesian-statistics/">Understand the Math Behind it All: Bayesian Statistics</a><span class="comhead"> (adobe.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4030061>80 points</span> by <a href="user?id=romil">romil</a> 16 hours ago | <a href="item?id=4030061">40 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">30.</td><td><center><a id=up_4029632 href="vote?for=4029632&dir=up&whence=%6e%65%77%73"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4029632></span></center></td><td class="title"><a href="http://danshipper.com/stop-taking-yourself-so-seriously">Stop Taking Yourself So Seriously</a><span class="comhead"> (danshipper.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4029632>148 points</span> by <a href="user?id=Peteris">Peteris</a> 21 hours ago | <a href="item?id=4029632">58 comments</a></td></tr><tr style="height:5px"></tr><tr style="height:10px"></tr><tr><td colspan=2></td><td class="title"><a href="news2">More</a></td></tr></table></td></tr><tr><td><img src="http://ycombinator.com/images/s.gif" height=10 width=0><table width="100%" cellspacing=0 cellpadding=1><tr><td bgcolor=#ff6600></td></tr></table><br>
22
+ <center><span class="yclinks"><a href="lists">Lists</a> | <a href="rss">RSS</a> | <a href="http://ycombinator.com/bookmarklet.html">Bookmarklet</a> | <a href="http://ycombinator.com/newsguidelines.html">Guidelines</a> | <a href="http://ycombinator.com/newsfaq.html">FAQ</a> | <a href="http://ycombinator.com/newsnews.html">News News</a> | <a href="item?id=363">Feature Requests</a> | <a href="http://ycombinator.com">Y Combinator</a> | <a href="http://ycombinator.com/apply.html">Apply</a> | <a href="http://ycombinator.com/lib.html">Library</a></span><br><br>
23
+ <form method=get action="http://www.hnsearch.com/search#request/all">Search: <input type=text name="q" value="" size=17></form><br>
24
+ </center></td></tr></table></center></body></html>
@@ -0,0 +1,24 @@
1
+ <html><head><link rel="stylesheet" type="text/css" href="http://ycombinator.com/news.css">
2
+ <link rel="shortcut icon" href="http://ycombinator.com/favicon.ico">
3
+ <script>
4
+ function byId(id) {
5
+ return document.getElementById(id);
6
+ }
7
+
8
+ function vote(node) {
9
+ var v = node.id.split(/_/); // {'up', '123'}
10
+ var item = v[1];
11
+
12
+ // hide arrows
13
+ byId('up_' + item).style.visibility = 'hidden';
14
+ byId('down_' + item).style.visibility = 'hidden';
15
+
16
+ // ping server
17
+ var ping = new Image();
18
+ ping.src = node.href;
19
+
20
+ return false; // cancel browser nav
21
+ } </script><title>New Links | Hacker News</title></head><body><center><table border=0 cellpadding=0 cellspacing=0 width="85%" bgcolor=#f6f6ef><tr><td bgcolor=#ff6600><table border=0 cellpadding=0 cellspacing=0 width="100%" style="padding:2px"><tr><td style="width:18px;padding-right:4px"><a href="http://ycombinator.com"><img src="http://ycombinator.com/images/y18.gif" width=18 height=18 style="border:1px #ffffff solid;"></img></a></td><td style="line-height:12pt; height:10px;"><span class="pagetop"><b><a href="news">Hacker News</a></b><img src="http://ycombinator.com/images/s.gif" height=1 width=10><span class="topsel"><a href="newest">new</a></span> | <a href="newcomments">comments</a> | <a href="ask">ask</a> | <a href="jobs">jobs</a> | <a href="submit">submit</a></span></td><td style="text-align:right;padding-right:4px;"><span class="pagetop"><a href="newslogin?whence=%6e%65%77%65%73%74">login</a></span></td></tr></table></td></tr><tr style="height:10px"></tr><tr><td><table border=0 cellpadding=0 cellspacing=0><tr><td align=right valign=top class="title">1.</td><td><center><a id=up_4032333 href="vote?for=4032333&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032333></span></center></td><td class="title"><a href="http://blog.silktide.com/2012/05/dear-ico-this-is-why-web-developers-hate-you/" rel="nofollow">Dear ICO: This Is Why Web Developers Hate You</a><span class="comhead"> (silktide.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032333>1 point</span> by <a href="user?id=oliveremberton">oliveremberton</a> 10 minutes ago | <a href="item?id=4032333">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">2.</td><td><center><a id=up_4032329 href="vote?for=4032329&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032329></span></center></td><td class="title"><a href="http://www.nytimes.com/2012/05/27/business/how-boaz-weinstein-and-hedge-funds-outsmarted-jpmorgan.html?pagewanted=all" rel="nofollow">How Boaz Weinstein and hedge funds outsmarted JPMorgan</a><span class="comhead"> (nytimes.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032329>1 point</span> by <a href="user?id=asto">asto</a> 11 minutes ago | <a href="item?id=4032329">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">3.</td><td><center><a id=up_4032324 href="vote?for=4032324&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032324></span></center></td><td class="title"><a href="https://www.youtube.com/watch?v=e7D3_eGaO5k&feature=related" rel="nofollow">Dr. Michio Kaku Says America Has A Secret Super Weapon (H1B)</a><span class="comhead"> (youtube.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032324>1 point</span> by <a href="user?id=DiabloD3">DiabloD3</a> 13 minutes ago | <a href="item?id=4032324">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">4.</td><td><center><a id=up_4032323 href="vote?for=4032323&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032323></span></center></td><td class="title"><a href="https://www.zipcar.com/members/choose-rate-plan" rel="nofollow">ZipCar's "extra value" Membership Option</a><span class="comhead"> (zipcar.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032323>1 point</span> by <a href="user?id=derwiki">derwiki</a> 13 minutes ago | <a href="item?id=4032323">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">5.</td><td><center><a id=up_4032312 href="vote?for=4032312&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032312></span></center></td><td class="title"><a href="item?id=4032312">Ask HN: Legality of price comparison scraping without permission</a></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032312>1 point</span> by <a href="user?id=aik48">aik48</a> 18 minutes ago | <a href="item?id=4032312">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">6.</td><td><center><a id=up_4032296 href="vote?for=4032296&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032296></span></center></td><td class="title"><a href="http://www.mondaynote.com/2012/05/27/facebook-the-collective-hallucination/" rel="nofollow">Facebook: The Collective Hallucination</a><span class="comhead"> (mondaynote.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032296>1 point</span> by <a href="user?id=mmayernick">mmayernick</a> 27 minutes ago | <a href="item?id=4032296">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">7.</td><td><center><a id=up_4032282 href="vote?for=4032282&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032282></span></center></td><td class="title"><a href="http://www.seomoz.org/blog/is-seo-the-answer-for-startup-marketing" rel="nofollow">Is SEO the Right Answer for Startups? Not Necessarily</a><span class="comhead"> (seomoz.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032282>1 point</span> by <a href="user?id=randfish">randfish</a> 34 minutes ago | <a href="item?id=4032282">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">8.</td><td><center><a id=up_4032251 href="vote?for=4032251&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032251></span></center></td><td class="title"><a href="http://www.sacvuittonfrance.com/" rel="nofollow">Louis vuitton</a><span class="comhead"> (sacvuittonfrance.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032251>1 point</span> by <a href="user?id=ibrkpf1614">ibrkpf1614</a> 44 minutes ago | <a href="item?id=4032251">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">9.</td><td><center><a id=up_4032248 href="vote?for=4032248&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032248></span></center></td><td class="title"><a href="http://klickverbot.at/blog/2012/05/purity-in-d/" rel="nofollow">Purity in D</a><span class="comhead"> (klickverbot.at) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032248>1 point</span> by <a href="user?id=klickverbot">klickverbot</a> 44 minutes ago | <a href="item?id=4032248">1 comment</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">10.</td><td><center><a id=up_4032242 href="vote?for=4032242&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032242></span></center></td><td class="title"><a href="http://owndj.com/" rel="nofollow">Show HN : A much better experience to build youtube playlist</a><span class="comhead"> (owndj.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032242>1 point</span> by <a href="user?id=serbrech">serbrech</a> 47 minutes ago | <a href="item?id=4032242">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">11.</td><td><center><a id=up_4032235 href="vote?for=4032235&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032235></span></center></td><td class="title"><a href="http://scrapbook.channel4.com" rel="nofollow">Channel4 - new scrapbook app</a><span class="comhead"> (channel4.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032235>1 point</span> by <a href="user?id=suchitpuri">suchitpuri</a> 52 minutes ago | <a href="item?id=4032235">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">12.</td><td><center><a id=up_4032219 href="vote?for=4032219&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032219></span></center></td><td class="title"><a href="http://blogs.wsj.com/tech-europe/2012/05/25/europe-caught-with-its-hand-in-the-cookie-jar/?mod=WSJBlog" rel="nofollow">Europe Caught in the Cookie Jar</a><span class="comhead"> (wsj.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032219>1 point</span> by <a href="user?id=voodoochilo">voodoochilo</a> 1 hour ago | <a href="item?id=4032219">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">13.</td><td><center><a id=up_4032213 href="vote?for=4032213&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032213></span></center></td><td class="title"><a href="http://cnnr.me/b/2012/05/your-first-node-dot-js-module/">Your first Node.js module</a><span class="comhead"> (cnnr.me) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032213>18 points</span> by <a href="user?id=c_t_montgomery">c_t_montgomery</a> 1 hour ago | <a href="item?id=4032213">3 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">14.</td><td><center><a id=up_4032197 href="vote?for=4032197&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032197></span></center></td><td class="title"><a href="http://www.thedailybeast.com/newsweek/2012/05/20/brian-greene-welcome-to-the-multiverse.html" rel="nofollow">Welcome to the Multiverse</a><span class="comhead"> (thedailybeast.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032197>1 point</span> by <a href="user?id=gruseom">gruseom</a> 1 hour ago | <a href="item?id=4032197">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">15.</td><td><center><a id=up_4032184 href="vote?for=4032184&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032184></span></center></td><td class="title"><a href="http://www.youtube.com/watch?v=jIWOR2bGC7c&feature=list_related&playnext=1&list=SPCDE38BA0F8AA9249" rel="nofollow">How Homomorphic Encryption Works</a><span class="comhead"> (youtube.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032184>3 points</span> by <a href="user?id=haliax">haliax</a> 1 hour ago | <a href="item?id=4032184">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">16.</td><td><center><a id=up_4032153 href="vote?for=4032153&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032153></span></center></td><td class="title"><a href="http://programmers.stackexchange.com/questions/149970/i-can-write-code-but-cant-design-well-any-suggestions" rel="nofollow">I can write code...but can't design well. Any suggestions? - Programmers</a><span class="comhead"> (stackexchange.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032153>1 point</span> by <a href="user?id=girishmony">girishmony</a> 1 hour ago | <a href="item?id=4032153">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">17.</td><td><center><a id=up_4032144 href="vote?for=4032144&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032144></span></center></td><td class="title"><a href="http://techcrunch.com/2012/05/27/facebook-phone-3/" rel="nofollow">It’ll Be A Miracle If The Facebook Phone Doesn’t Suck</a><span class="comhead"> (techcrunch.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032144>2 points</span> by <a href="user?id=daegloe">daegloe</a> 1 hour ago | <a href="item?id=4032144">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">18.</td><td><center><a id=up_4032142 href="vote?for=4032142&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032142></span></center></td><td class="title"><a href="http://www.danshapiro.com/blog/2012/05/what-if-you-could-only-speak-once-a-year/" rel="nofollow">What If You Could Only Speak Once a Year</a><span class="comhead"> (danshapiro.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032142>1 point</span> by <a href="user?id=danshapiro">danshapiro</a> 1 hour ago | <a href="item?id=4032142">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">19.</td><td><center><a id=up_4032137 href="vote?for=4032137&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032137></span></center></td><td class="title"><a href="http://fda.gov/" rel="nofollow">Many .gov domains fail to resolve without www.</a><span class="comhead"> (fda.gov) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032137>2 points</span> by <a href="user?id=zone411">zone411</a> 1 hour ago | <a href="item?id=4032137">1 comment</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">20.</td><td><center><a id=up_4032127 href="vote?for=4032127&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032127></span></center></td><td class="title"><a href="http://www.mpg.de/5809418/reactor_accidents" rel="nofollow">Risk of contamination from severe nuclear reactor accidents higher than expected</a><span class="comhead"> (mpg.de) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032127>2 points</span> by <a href="user?id=stfu">stfu</a> 1 hour ago | <a href="item?id=4032127">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">21.</td><td><center><a id=up_4032108 href="vote?for=4032108&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032108></span></center></td><td class="title"><a href="http://spectrum.ieee.org/biomedical/devices/bioengineers-make-dna-into-a-living-flash-drive" rel="nofollow">Bioengineers Make DNA Into a Living Flash Drive</a><span class="comhead"> (ieee.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032108>1 point</span> by <a href="user?id=tysont">tysont</a> 1 hour ago | <a href="item?id=4032108">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">22.</td><td><center><a id=up_4032065 href="vote?for=4032065&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032065></span></center></td><td class="title"><a href="http://www.theage.com.au/technology/technology-news/daring-to-fail-at-23-australias-hackathon-hero-20120525-1z98i.html" rel="nofollow">Daring to fail at 23: Australia's hackathon hero</a><span class="comhead"> (theage.com.au) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032065>3 points</span> by <a href="user?id=bootload">bootload</a> 2 hours ago | <a href="item?id=4032065">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">23.</td><td><center><a id=up_4032046 href="vote?for=4032046&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032046></span></center></td><td class="title"><a href="http://www.slate.com/articles/business/moneybox/2012/05/facebook_george_lucas_and_nimbyism_the_idiotic_rules_preventing_silicon_valley_from_building_the_houses_and_offices_we_need_to_power_american_innovation_.html/" rel="nofollow">Dumb rules prevent Silicon Valley from building needed houses and offices</a><span class="comhead"> (slate.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032046>3 points</span> by <a href="user?id=jseliger">jseliger</a> 2 hours ago | <a href="item?id=4032046">3 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">24.</td><td><center><a id=up_4032031 href="vote?for=4032031&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032031></span></center></td><td class="title"><a href="http://www.freenetpages.co.uk/hp/alan.gauld/tutfctnl.htm" rel="nofollow">Functional Programming in Python</a><span class="comhead"> (freenetpages.co.uk) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032031>3 points</span> by <a href="user?id=michaelkscott">michaelkscott</a> 2 hours ago | <a href="item?id=4032031">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">25.</td><td><center><a id=up_4032030 href="vote?for=4032030&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032030></span></center></td><td class="title"><a href="http://www.newyorker.com/reporting/2012/06/04/120604fa_fact_gibson?currentPage=all">William Gibson: Seeing the Future in Science Fiction</a><span class="comhead"> (newyorker.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032030>21 points</span> by <a href="user?id=jseliger">jseliger</a> 2 hours ago | <a href="item?id=4032030">9 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">26.</td><td><center><a id=up_4032020 href="vote?for=4032020&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032020></span></center></td><td class="title"><a href="https://github.com/mitchellh/html7">Show HN: HTML7 - Modern HTML</a><span class="comhead"> (github.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032020>11 points</span> by <a href="user?id=mitchellh">mitchellh</a> 2 hours ago | <a href="item?id=4032020">9 comments</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">27.</td><td><center><a id=up_4032017 href="vote?for=4032017&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4032017></span></center></td><td class="title"><a href="http://www.thecreatorsproject.com/blog/zeron-a-levitating-orb-gestural-interface-straight-out-of-sci-fi" rel="nofollow">A new 3D input device using computer controlled magnetic levitation</a><span class="comhead"> (thecreatorsproject.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4032017>1 point</span> by <a href="user?id=damian2000">damian2000</a> 2 hours ago | <a href="item?id=4032017">discuss</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">28.</td><td><center><a id=up_4031996 href="vote?for=4031996&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031996></span></center></td><td class="title"><a href="http://arxiv.org/abs/1205.5662" rel="nofollow">Google+ or Google-?: Active users represent 10.3% of the whole population</a><span class="comhead"> (arxiv.org) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031996>2 points</span> by <a href="user?id=friggeri">friggeri</a> 2 hours ago | <a href="item?id=4031996">1 comment</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">29.</td><td><center><a id=up_4031994 href="vote?for=4031994&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031994></span></center></td><td class="title"><a href="item?id=4031994">Why are we able to share any Facebook photo by copying its URL</a></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031994>1 point</span> by <a href="user?id=lemieux">lemieux</a> 2 hours ago | <a href="item?id=4031994">1 comment</a></td></tr><tr style="height:5px"></tr><tr><td align=right valign=top class="title">30.</td><td><center><a id=up_4031982 href="vote?for=4031982&dir=up&whence=%6e%65%77%65%73%74"><img src="http://ycombinator.com/images/grayarrow.gif" border=0 vspace=3 hspace=2></a><span id=down_4031982></span></center></td><td class="title"><a href="http://imgur.com/a/Z5bOM" rel="nofollow">Show HN: Concept UI for Everything [File searching app for Windows]</a><span class="comhead"> (imgur.com) </span></td></tr><tr><td colspan=2></td><td class="subtext"><span id=score_4031982>1 point</span> by <a href="user?id=elisk">elisk</a> 2 hours ago | <a href="item?id=4031982">discuss</a></td></tr><tr style="height:5px"></tr><tr style="height:10px"></tr><tr><td colspan=2></td><td class="title"><a href="/x?fnid=0zvVDJ3ZNE" rel="nofollow">More</a></td></tr></table></td></tr><tr><td><img src="http://ycombinator.com/images/s.gif" height=10 width=0><table width="100%" cellspacing=0 cellpadding=1><tr><td bgcolor=#ff6600></td></tr></table><br>
22
+ <center><span class="yclinks"><a href="lists">Lists</a> | <a href="rss">RSS</a> | <a href="http://ycombinator.com/bookmarklet.html">Bookmarklet</a> | <a href="http://ycombinator.com/newsguidelines.html">Guidelines</a> | <a href="http://ycombinator.com/newsfaq.html">FAQ</a> | <a href="http://ycombinator.com/newsnews.html">News News</a> | <a href="item?id=363">Feature Requests</a> | <a href="http://ycombinator.com">Y Combinator</a> | <a href="http://ycombinator.com/apply.html">Apply</a> | <a href="http://ycombinator.com/lib.html">Library</a></span><br><br>
23
+ <form method=get action="http://www.hnsearch.com/search#request/all">Search: <input type=text name="q" value="" size=17></form><br>
24
+ </center></td></tr></table></center></body></html>
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ module HackerNews
4
+ describe Engine do
5
+ subject { Engine }
6
+ let(:engine) { subject }
7
+ it { should respond_to :homepage }
8
+
9
+ it "should fetch homepage items" do
10
+ engine.homepage.count.should == 30
11
+ end
12
+
13
+ it "should fetch newest items" do
14
+ engine.newest.count.should == 30
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+ require "chronic"
3
+
4
+ module HackerNews
5
+ describe EntryParser do
6
+ subject { EntryParser.new }
7
+ it { should respond_to :homepage }
8
+ let(:parser) { subject }
9
+
10
+ context "homepage" do
11
+ it "should parse them right" do
12
+ parser.stub(:open).and_return(open('spec/fixtures/home.html'))
13
+ entries = parser.homepage
14
+ entries.count.should == 30
15
+ entries.first.should be_an Entry
16
+ entries.each do |entry|
17
+ entry.id.should > 4000000
18
+ entry.user.should =~ /\w+/
19
+ entry.link.should =~ /^http/ unless entry.site.nil?
20
+ entry.title.should_not be_empty
21
+ entry.num_comments.should > 0
22
+ entry.site.should_not =~ /^http/
23
+ entry.points.should > 0
24
+ Chronic.parse(entry.time_string).should < Time.now
25
+ end
26
+ end
27
+ end
28
+
29
+ context "newest" do
30
+ it "should parse them right" do
31
+ parser.stub(:open).and_return(open('spec/fixtures/newest.html'))
32
+ entries = parser.newest
33
+ entries.count.should == 30
34
+ entries.first.should be_an Entry
35
+ entries.each do |entry|
36
+ entry.id.should > 4000000
37
+ entry.user.should =~ /\w+/
38
+ entry.link.should =~ /^http/ unless entry.site.nil?
39
+ entry.title.should_not be_empty
40
+ entry.num_comments.should >= 0
41
+ entry.site.should_not =~ /^http/
42
+ entry.points.should >= 0
43
+ Chronic.parse(entry.time_string).should < Time.now
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,11 @@
1
+ require "simplecov"
2
+ SimpleCov.start do
3
+ add_filter 'spec'
4
+ end
5
+
6
+ require "open-uri"
7
+ require 'hn'
8
+
9
+ def fixture(filename)
10
+ open("spec/fixtures/#{filename}") { |file| file.read }
11
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Forrest Ye
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70199363409420 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70199363409420
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &70199363409000 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70199363409000
36
+ - !ruby/object:Gem::Dependency
37
+ name: simplecov
38
+ requirement: &70199363408580 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70199363408580
47
+ - !ruby/object:Gem::Dependency
48
+ name: chronic
49
+ requirement: &70199363408160 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70199363408160
58
+ - !ruby/object:Gem::Dependency
59
+ name: nokogiri
60
+ requirement: &70199363407740 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70199363407740
69
+ description: A tiny gem to fetch Hacker News entries
70
+ email:
71
+ - afu@forresty.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - hn.gemspec
83
+ - lib/hn.rb
84
+ - lib/hn/common.rb
85
+ - lib/hn/engine.rb
86
+ - lib/hn/models/entry.rb
87
+ - lib/hn/parsers/entry_parser.rb
88
+ - lib/hn/version.rb
89
+ - spec/fixtures/home.html
90
+ - spec/fixtures/newest.html
91
+ - spec/hn/engine_spec.rb
92
+ - spec/hn/parsers/entry_parser_spec.rb
93
+ - spec/spec_helper.rb
94
+ homepage: https://github.com/forresty/hn
95
+ licenses: []
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ segments:
107
+ - 0
108
+ hash: 3803145340244818705
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ segments:
116
+ - 0
117
+ hash: 3803145340244818705
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 1.8.11
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: A tiny gem to fetch Hacker News entries
124
+ test_files:
125
+ - spec/fixtures/home.html
126
+ - spec/fixtures/newest.html
127
+ - spec/hn/engine_spec.rb
128
+ - spec/hn/parsers/entry_parser_spec.rb
129
+ - spec/spec_helper.rb