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
begin | |
Integer("foo", exception: false) | |
def parse_int string, default | |
Integer(string, exception: false) || default | |
end | |
rescue TypeError | |
def parse_int string, default | |
Integer(string) | |
rescue |
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
From 8f74c91274a7e1072685aded111e89d55ced0f96 Mon Sep 17 00:00:00 2001 | |
From: Aaron Patterson <[email protected]> | |
Date: Sun, 21 Oct 2018 16:12:16 -0700 | |
Subject: [PATCH] Collapse putobject, putobject, newarray | |
This collapses: | |
```== disasm: #<ISeq:[email protected]:3 (3,0)-(5,3)> (catch: FALSE) | |
0000 putobject "a" ( 4)[LiCa] | |
0002 putobject "b" |
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
From 8f74c91274a7e1072685aded111e89d55ced0f96 Mon Sep 17 00:00:00 2001 | |
From: Aaron Patterson <[email protected]> | |
Date: Sun, 21 Oct 2018 16:12:16 -0700 | |
Subject: [PATCH] Collapse putobject, putobject, newarray | |
This collapses: | |
```== disasm: #<ISeq:[email protected]:3 (3,0)-(5,3)> (catch: FALSE) | |
0000 putobject "a" ( 4)[LiCa] | |
0002 putobject "b" |
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
From 8f74c91274a7e1072685aded111e89d55ced0f96 Mon Sep 17 00:00:00 2001 | |
From: Aaron Patterson <[email protected]> | |
Date: Sun, 21 Oct 2018 16:12:16 -0700 | |
Subject: [PATCH] Collapse putobject, putobject, newarray | |
This collapses: | |
```== disasm: #<ISeq:[email protected]:3 (3,0)-(5,3)> (catch: FALSE) | |
0000 putobject "a" ( 4)[LiCa] | |
0002 putobject "b" |
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
# extract dead objects from the heap | |
require 'json' | |
require 'set' | |
class Slot | |
attr_reader :info, :address_to_slot | |
def initialize info, address_to_slot | |
@info = info |
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 'ds9' | |
require 'socket' | |
require 'uri' | |
require 'google/protobuf' | |
require 'io/wait' | |
require 'helloworld_pb' | |
class MySession < DS9::Client | |
def initialize sock | |
@sock = sock |
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 'uart' | |
require 'io/wait' | |
class Sample < Struct.new(:time, | |
:pm1_0_standard, :pm2_5_standard, :pm10_standard, | |
:pm1_0_env, :pm2_5_env, | |
:concentration_unit, | |
:particle_03um, :particle_05um, :particle_10um, | |
:particle_25um, :particle_50um, :particle_100um) | |
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
#!/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby | |
require 'benchmark/ips' | |
require './lib/track_obj' | |
if ARGV[0] == "--trace" | |
tp = TrackObj.make_tp | |
tp.enable | |
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
cons = lambda { |a, b| | |
lambda { |m| m.call(a, b) } | |
} | |
car = lambda { |m| m.call(lambda { |a, _| a }) } | |
cdr = lambda { |m| m.call(lambda { |_, b| b }) } | |
# A list that only uses lambdas | |
list = cons.call(1, cons.call(2, cons.call(3, nil))) |
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 foo ; | |
puts ; | |
end | |
foo "hello" |