I hereby claim:
- I am davidbalbert on github.
- I am davidbalbert (https://keybase.io/davidbalbert) on keybase.
- I have a public key ASBC8M_8mgPzPaiFefNsrkHVhVAe9Snd74nBao4d-TZN2Ao
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| # Use with your code: | |
| # $ grep -hIEro '\d+' . | ruby path/to/numbers.rb | |
| tens = 0 | |
| fives = 0 | |
| twos = 0 | |
| evens = 0 | |
| odds = 0 | |
| count = 0 |
| class PowersOfTwo | |
| include Enumerable | |
| class << self | |
| include Enumerable | |
| def each(&block) | |
| new.each(&block) | |
| end | |
| end |
| #!/usr/bin/env ruby | |
| require 'nokogiri' | |
| unless ARGV.size > 0 | |
| STDERR.puts "usage: #{$0} html-file" | |
| exit 1 | |
| end | |
| doc = File.open(ARGV[0]) { |f| Nokogiri::HTML(f) } |
I hereby claim:
To claim this, I am signing this object:
| // Redux | |
| function createStore(reducer) { | |
| let state; | |
| let listeners = []; | |
| const store = { | |
| dispatch(action) { | |
| state = reducer(state, action); | |
| #!/usr/bin/env ruby | |
| if ARGV.size == 0 | |
| STDERR.puts "missing argument" | |
| exit 1 | |
| end | |
| ARGV.each do |name| | |
| s = File.read(name) |
| begin | |
| require 'bundler/inline' | |
| rescue LoadError => e | |
| $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
| raise e | |
| end | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' |
| #!/usr/bin/env ruby | |
| if ARGV.empty? | |
| $stderr.puts("usage: #{$0} rdio-or-spotify-url") | |
| exit 1 | |
| end | |
| require 'net/http' | |
| require 'uri' |
| class Object | |
| def not | |
| NotProxy.new(self) | |
| end | |
| end | |
| class NotProxy | |
| def initialize(obj) | |
| @obj = obj | |
| end |
| # Generic functions in Ruby | |
| # | |
| # How to use it: | |
| # | |
| # plus = Multi.new | |
| # plus.add_method(Numeric, Numeric) { |a, bi| a + b } | |
| # plus.call(1, 2) #=> 3 | |
| # | |
| # For some more fun: | |
| # |