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
| // go run slurp.go rubyhq.com pythonhq.com javahq.com erlanghq.com | |
| package main | |
| import "net" | |
| import "fmt" | |
| import "os" | |
| func lookup (name string, c chan string) { | |
| h, err := net.LookupHost(name) | |
| var answer string |
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
| unfold(Fun, Seed) -> | |
| case Fun(Seed) of | |
| {} -> []; | |
| {X, NextSeed} -> [X | unfold(Fun, NextSeed)] | |
| 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
| (defn mean | |
| "The aritmetic mean (average) of xs" | |
| [xs] | |
| (double | |
| (/ (reduce + xs) | |
| (count xs)))) | |
| (defn gaussians | |
| "An infinite sequence of gaussians about 0 with variance v" | |
| [v] |
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
| org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `<<' for nil:NilClass | |
| Rack::Builder.run(/Users/franco.lazzarino/.rvm/gems/jruby-1.6.5/gems/rack-flash-0.1.1/lib/rack/flash.rb:20) | |
| #<Class:0x4c0effc4>.(root)(vfs:/Users/franco.lazzarino/Projects/backstage/config.ru:6) | |
| org.jruby.RubyBasicObject.instance_eval(org/jruby/RubyBasicObject.java:1720) | |
| Rack::Builder.initialize(/Users/franco.lazzarino/.rvm/gems/jruby-1.6.5/gems/rack-1.4.0/lib/rack/builder.rb:51) | |
| #<Class:0x7a8a44a6>.(root)(vfs:/Users/franco.lazzarino/Projects/backstage/config.ru:3) |
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 'ruby-prof' | |
| module M | |
| def foo | |
| puts "M#foo" | |
| end | |
| end | |
| class C | |
| 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
| abstract class LinkedList[T] { | |
| def add(someV: T) = new Node(someV, this) | |
| def get(index: Int):T | |
| def length:Int | |
| } | |
| class Empty[T] extends LinkedList[T] { | |
| def get(_index: Int) = sys.error("index out of bounds") | |
| def length = 0 | |
| override def toString = "" |
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 'torquebox' | |
| topic = TorqueBox::Messaging::Topic.new '/topics/assign_port' | |
| topic.publish 'foo' |
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 'riak' | |
| require 'json' | |
| require 'benchmark' | |
| require 'pp' | |
| $client = Riak::Client.new :protocol => :pbc | |
| def keys_in_range |
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 'riak' | |
| require 'json' | |
| require 'benchmark' | |
| require 'pp' | |
| $client = Riak::Client.new :protocol => :pbc | |
| def keys_in_range | |
| mr = Riak::MapReduce.new($client). |
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 'riak' | |
| require 'json' | |
| require 'benchmark' | |
| require 'pp' | |
| $client = Riak::Client.new :protocol => :pbc | |
| def latest_10_via_values | |
| mr = Riak::MapReduce.new($client). |