Conway's Game of Life in Erlang, in 2 hours, with 0 Erlang experience, in 20 lines of code.
1337 h4x0rs:
- @jszmajda
- @ngauthier
- @ericoestrich
- @danivovich
- @kafuchau
| Given /^I visit subdomain (.+)$/ do |sub| | |
| host! "#{sub}.#{TEST_DOMAIN}" #TEST_DOMAIN is defined in test.rb. In my case TEST_DOMAIN = 'example.com' | |
| end |
| attachments: parent_id, asset_id | |
| domain_names: organisation_id | |
| event_memberships: user_id, event_id | |
| events: editor_id | |
| group_actions: user_id, group_id | |
| groups: user_id | |
| icons: parent_id | |
| invitations: sender_id | |
| legacy_actions: item_upon_id | |
| news_items: author_id |
| require 'irb' | |
| module IRB | |
| def self.start_session(binding) | |
| IRB.setup(nil) | |
| workspace = WorkSpace.new(binding) | |
| if @CONF[:SCRIPT] | |
| irb = Irb.new(workspace, @CONF[:SCRIPT]) |
| ENV["WATCHR"] = "1" | |
| system 'clear' | |
| def growl(message) | |
| growlnotify = `which growlnotify`.chomp | |
| title = "Watchr Test Results" | |
| image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
| options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
| system %(#{growlnotify} #{options} &) | |
| end |
| Then /^debugger$/ do | |
| debugger | |
| :debugger | |
| end |
| # a messy hack written by Edd Dumbill. http://twitter.com/edd | |
| # You may need to rerun this script if you hit a Twitter Error because you | |
| # use up API rate limiting. That's why we pickle the results, so we can resume | |
| # where we left off. | |
| # get the twitter module using 'easy_install twitter' | |
| from twitter.api import Twitter, TwitterError | |
| from twitter.oauth import OAuth |
| # Pass in the name of the site you wich to create a cert for | |
| domain_name = ARGV[0] | |
| if domain_name == nil | |
| puts "Y U No give me a domain name?" | |
| else | |
| system "openssl genrsa -out #{domain_name}.key 1024" | |
| system "openssl req -new -key #{domain_name}.key -out #{domain_name}.csr -subj '/C=US/ST=NJ/L=Monroe/O=MyCompany/OU=IT/CN=#{domain_name}'" | |
| system "cp #{domain_name}.key #{domain_name}.key.bak" |
Conway's Game of Life in Erlang, in 2 hours, with 0 Erlang experience, in 20 lines of code.
1337 h4x0rs:
| # usage: | |
| # it "should return a result of 5" do | |
| # eventually { long_running_thing.result.should eq(5) } | |
| # end | |
| module AsyncHelper | |
| def eventually(:options = {}) | |
| timeout = options[:timeout] || 2 | |
| interval = options[:interval] || 0.1 | |
| time_limit = Time.now + timeout | |
| loop do |
| Life | DistanceWithin3AU | TempUnder375 | Water | Atmosphere | ClassM | GasGiant | |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 0 | 1 | |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 | |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | |
| 0 | 1 | 0 | 0 | 1 | 0 | 1 | |
| 0 | 1 | 0 | 1 | 0 | 0 | 1 | |
| 0 | 1 | 1 | 0 | 1 | 0 | 1 | |
| 1 | 0 | 1 | 1 | 1 | 0 | 0 | |
| 0 | 1 | 0 | 0 | 1 | 0 | 1 |