This file contains 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
#include <stdio.h> | |
/* prints 78.882004 */ | |
int main(int argc, char** argv) { | |
float f = 78.882; | |
printf("%f\n", f); | |
return 0; | |
} |
This file contains 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
$ RBXOPT=-Xprofile\ -Xprofiler.graph\ -Xprofiler.full_report rbx -S rspec spec -f p &>foo | |
bash-3.2$ vim foo | |
bash-3.2$ grep Array#map foo | |
0.00 0.22 1 Array#map [74] | |
[74] 0.3 0.00 0.22 1 Array#map [74] | |
0.00 0.22 1 Array#map [74] | |
0.00 0.22 4 Array#map [76] | |
[76] 0.3 0.00 0.22 4 Array#map [76] | |
0.00 0.22 4 Array#map [76] | |
0.00 0.22 1 Array#map [80] |
This file contains 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
ruby-1.9.2-p180 :008 > z = Fiber.new{Thread.current}.resume | |
=> #<Thread:0x00000100887678 run> | |
ruby-1.9.2-p180 :009 > Thread.current | |
=> #<Thread:0x00000100887678 run> | |
ruby-1.9.2-p180 :010 > z = Fiber.new{Thread.current.object_id}.resume | |
=> 2151955260 | |
ruby-1.9.2-p180 :011 > Thread.current.object_id | |
=> 2151955260 |
This file contains 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 foo | |
puts "before: '#{$~}'" | |
/foo/ =~ 'foo' | |
puts "after: '#{$~}'" | |
clear_last_match | |
puts "after call: '#{$~}' (should still be set)" | |
end | |
def clear_last_match | |
$~ = nil |
This file contains 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
# Performs normal match and returns MatchData object from $~ or nil. | |
def match(str) | |
unless str | |
Regexp.last_match = nil | |
return nil | |
end | |
str = StringValue(str) | |
Regexp.last_match = search_region(str, 0, str.size, true) |
This file contains 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
# Performs normal match and returns MatchData object from $~ or nil. | |
def match(str) | |
unless str | |
Regexp.last_match = nil | |
return nil | |
end | |
str = StringValue(str) | |
Regexp.last_match = search_region(str, 0, str.size, true) |
This file contains 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-head-hydra :002 > foo = /foo/.match "foo" | |
=> #<MatchData "foo"> | |
rbx-head-hydra :003 > bar = /bar/.match "bar" | |
=> #<MatchData "bar"> | |
rbx-head-hydra :004 > $~ | |
=> #<MatchData "bar"> | |
rbx-head-hydra :005 > $~ = foo | |
=> #<MatchData "foo"> | |
rbx-head-hydra :006 > $~ | |
=> #<MatchData "bar"> |
This file contains 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
diff --git a/spec/ruby/language/regexp/back-references_spec.rb b/spec/ruby/langu | |
index c09a165..fe0d9e0 100644 | |
--- a/spec/ruby/language/regexp/back-references_spec.rb | |
+++ b/spec/ruby/language/regexp/back-references_spec.rb | |
@@ -7,6 +7,13 @@ describe "Regexps with back-references" do | |
$~.to_a.should == ["ll"] | |
end | |
+ it 'allows the $~ pseudo-global varable to be assigned' do | |
+ "hello" =~ /l+/ |
This file contains 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
$ bundle exec rspec spec -fd | |
Callisto::Lexer | |
#tokenize | |
tokenizes a blank message to an empty array | |
tokenizes 'key' into a single identifier | |
tokenizes 'foo bar' into two identifiers | |
tokenizes hex numbers | |
tokenizes integers | |
tokenizes numbers starting with a decimal point |
This file contains 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
rvm install --trace --branch hydra rbx-hydra | |
--trace --branch hydra rbx-hydra | |
rvm 1.2.8 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/] | |
+ [[ -z '' ]] | |
+ export 'PS4=+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }' | |
+ PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }' | |
+[/Users/david/.rvm/scripts/cli] : 705 : __rvm_parse_args() $ [[ -z install ]] | |
+[/Users/david/.rvm/scripts/cli] : 707 : __rvm_parse_args() $ [[ 0 -eq 1 ]] |