This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'mechanize' | |
| require 'tidied_html_page.rb' | |
| a = WWW::Mechanize.new do |agent| | |
| agent.user_agent_alias = 'Mac Safari' | |
| agent.log = Logger.new(File.open('parser.log', 'w+')) | |
| agent.pluggable_parser.html = TidiedHTMLPage | |
| agent.pluggable_parser.xhtml = TidiedHTMLPage | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec/expectations' | |
| require 'webrat' | |
| Webrat.configure do |config| | |
| config.mode = :mechanize | |
| end | |
| class MechanizeWorld < Webrat::MechanizeAdapter | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl http://europe.wsj.com/home-page > wsj.html | |
| curl --data-binary @wsj.html g.pdfgenapp.com > wsj.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AttributeBuilder | |
| def initialize(attrs = {}) | |
| attrs ||= {} | |
| attrs.each do |key, value| | |
| self.send("#{key}=", value) | |
| end | |
| end | |
| end | |
| module MemberBuilder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class School { | |
| private List<SchoolClass> m_classes = new ArrayList<SchoolClass>(); | |
| private List<SchoolRoom> m_rooms = new ArrayList<SchoolRoom>(); | |
| public School() { | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Namespaces in Ruby: what is the difference between | |
| class A::B | |
| end | |
| and | |
| module A | |
| class B | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @asp1 = Factory(:asp, :name => "ASP1", :school_name => "School 1", :school_district => "District 1", :region_id => regions(:us_co).id) | |
| @asp2 = Factory(:asp, :name => "ASP2", :school_name => "School 2", :school_district => "District 2", :region_id => regions(:us_co).id) | |
| @asp3 = Factory(:asp, :name => "ASP3", :school_name => "School 3", :school_district => "District 3", :region_id => regions(:us_co).id) | |
| @asp4 = Factory(:asp, :name => "ASP4", :school_name => "School 4", :school_district => "District 3", :region_id => regions(:us_co).id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MethodMissing | |
| def method_missing(name, *args) | |
| msg = name.to_s[/print_(.*)/, 1] | |
| print msg | |
| end | |
| end | |
| class LazyMethodDefine | |
| def method_missing(name, *args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'open-uri' | |
| require 'thread' | |
| # This is the index file with the filings | |
| index_url = "http://www.sec.gov/Archives/edgar/daily-index/master.20110701.idx" | |
| queue = Queue.new | |
| system "mkdir -p 20110701" | |
| Dir.chdir "20110701" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| # input comes from STDIN (standard input) | |
| for line in sys.stdin: | |
| # remove leading and trailing whitespace | |
| line = line.strip() | |
| # split the line into words | |
| words = line.split() |
OlderNewer