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 -e 'require "date"; f=File.open("results.txt", "w"); (2013..2019).to_a.reverse.map{|y| (1..12).to_a.reverse.each{|m| d = Date.new(y, m, 1); next if d < Date.new(2013, 4, 3) || d > Date.new(2019, 2, 1); d = d.strftime("%Y-%m-%d"); commit = `git log --before=#{d} -n 1 --format=format:"%H"`.chomp; f.puts "#{d}: #{commit}"; f.puts `git checkout #{commit} && ruby stats.rb` }}' |
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
require 'blankslate' | |
class Functioniser < BlankSlate | |
class Func | |
def initialize(method) | |
@method = method | |
end | |
def to_proc | |
->(x, *args) { x.send(@method, *args)} |
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
require "set" | |
class Proc | |
def self.register_type(klass, proc) | |
@types_to_convert ||= {} | |
@types_to_convert[klass] = proc | |
end | |
def self.[](field) | |
-> (x) { (@types_to_convert || {})[field.class].call(field, x) } |
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
class Dsl | |
Change = Struct.new(:state, :new_directions) | |
def initialize | |
@state_count = 0 | |
@sensor_changes = {} | |
end | |
def start(directions) | |
@start_directions = [directions].flatten |