Skip to content

Instantly share code, notes, and snippets.

View tenderlove's full-sized avatar
©️
 ​[object Object] :trollface:

Aaron Patterson tenderlove

©️
 ​[object Object] :trollface:
View GitHub Profile
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
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"
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"
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"
# 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
require 'ds9'
require 'socket'
require 'uri'
require 'google/protobuf'
require 'io/wait'
require 'helloworld_pb'
class MySession < DS9::Client
def initialize sock
@sock = sock
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
#!/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
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)))
def foo ;
puts ;
end
foo "hello"