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
def initialize | |
@server = self | |
@callback_server = Sinatra.new do | |
post '/callback' do | |
puts "Sinatra got request with params #{params.inspect}" | |
settings.this.update_queue << { :blah } | |
end | |
end | |
@callback_server.port = callback_port |
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
# Fails with: | |
# $ ruby test.rb | |
# /Users/will/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/thread.rb:189:in `sleep': deadlock detected (fatal) | |
# from /Users/will/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/thread.rb:189:in `block in pop' | |
# from <internal:prelude>:10:in `synchronize' | |
# from /Users/will/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/thread.rb:184:in `pop' | |
# from test.rb:27:in `<main>' | |
require 'thread' |
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 Category | |
def to_tree | |
{ | |
'category' => self, | |
'children' => self.children.map { |c| c.to_tree } | |
} | |
end | |
end | |
class Categories |
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
$ rbx -X18 -e '"".match /[^\u{20}-\u{7E}]/' | |
An exception occurred evaluating command line code | |
empty range in char class: [^\u{20}-\u{7E}] (RegexpError) | |
Backtrace: | |
Regexp#initialize at kernel/common/regexp18.rb:27 | |
Class#new at kernel/alpha.rb:96 | |
{ } in Object#__script__ at -e:1 | |
Rubinius::BlockEnvironment#call_on_instance at kernel/common/block_environment.rb:75 | |
Kernel(Rubinius::Loader)#eval at kernel/common/eval.rb:75 |
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
1.9.3p286 :003 > a = [1,2,3] | |
=> [1, 2, 3] | |
1.9.3p286 :004 > a.shift | |
=> 1 | |
1.9.3p286 :005 > a | |
=> [2, 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
[1.9.3] ~ $ ruby -e 'one = two = "something".gsub "o", "0"' | |
[1.9.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
CRASH: A fatal error has occurred. | |
Backtrace: | |
0 rbx 0x000000010a29e4d0 _ZN8rubiniusL12segv_handlerEi + 544 | |
1 libsystem_c.dylib 0x00007fff8f5b98ea _sigtramp + 26 | |
2 ??? 0x000000010b9efab8 0x0 + 4489935544 | |
3 rbx 0x000000010a3b90b2 _ZN8rubinius12CompiledCode4Info4markEPNS_6ObjectERNS_10ObjectMarkE + 318 | |
4 rbx 0x000000010a44fa0e _ZN8rubinius16GarbageCollector11scan_objectEPNS_6ObjectE + 456 | |
5 rbx 0x000000010a44d42b _ZN8rubinius7BakerGC7collectERNS_6GCDataEPNS_17YoungCollectStatsE + 107 | |
6 rbx 0x000000010a374189 _ZN8rubinius12ObjectMemory13collect_youngERNS_6GCDataEPNS_17YoungCollectStatsE + 67 |
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
[1.9.3] ~/www/demo $ curl -v -d auth_token=8ygqnnCEyVvj9qkdX63W http://localhost:3000/foo.json | |
* About to connect() to localhost port 3000 (#0) | |
* Trying ::1... | |
* Connection refused | |
* Trying 127.0.0.1... | |
* connected | |
* Connected to localhost (127.0.0.1) port 3000 (#0) | |
> POST /foo.json HTTP/1.1 | |
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5 | |
> Host: localhost:3000 |
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
[1.9.3] ~/www/demo $ curl -v -d auth_token=8ygqnnCEyVvj9qkdX63W http://localhost:3000/foo.json | |
* About to connect() to localhost port 3000 (#0) | |
* Trying ::1... | |
* Connection refused | |
* Trying 127.0.0.1... | |
* connected | |
* Connected to localhost (127.0.0.1) port 3000 (#0) | |
> POST /foo.json HTTP/1.1 | |
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5 | |
> Host: localhost:3000 |
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
I saw C++ coming and read the book - or at least tried to read the book - | |
there's a dent | |
in the wall behind my piano, where the book hit the wall - Improvements to | |
C should make things | |
easier not more complicated, I thought. | |
-- Joe Armstrong, http://erlang.org/pipermail/erlang-questions/2013-January/071949.html |