View promisify-node4.js
const promisify = (fn) => {
return function () {
const args = Array.from(arguments);
return new Promise(function (resolve, reject) {
fn.apply(undefined, args.concat([function (error, data) {
if (error) return reject(error);
if (data === undefined) return resolve();
return resolve(data);

Fast/efficient approach:

-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id =")
   -> 1.3197s

Slow/naïve approach:


Keybase proof

I hereby claim:

  • I am rmm5t on github.
  • I am rmm5t ( on keybase.
  • I have a public key whose fingerprint is 79DA 34B8 A2E7 3C96 E0CC 5BB2 005A C77D 7CBF 3EAF

To claim this, I am signing this object:

View bob.rb
class Bob
def respond_to(input)
@input = input.strip
return "Fine. Be that way!" if silence?
return "Whoa, chill out!" if shouting?
return "Sure." if question?
View hamming_bm.rb
# Courtesy @zenspider
class Hamming0
def self.compute s1, s2
length = [s1.length, s2.length].min
length.times.count { |i| s1[i] != s2[i] }
View Gemfile
source ''
ruby '2.1.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
gem 'sqlite3'
## Assets
gem "sprockets-rails", "~> 2.1.3"
# Use SCSS for stylesheets

ruby-1.9.3-p448 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p448 with the railsexpress patchsets:


You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

View euler010.rb
#!/usr/bin/env ruby
require "prime"
max = (ARGV[0] || 2_000_000).to_i
print "Sum of primes below #{max}: "
puts Prime.each(max - 1).inject(&:+)

Ruby 1.9.3-p392

$ time script/rails console
Loading development environment (Rails 3.2.12)
>> ^D

real    0m7.363s
user    0m6.352s
sys     0m0.919s
View stop_words.rb
StopWords = %w(a able about above abroad according accordingly across actually
adj after afterwards again against ago ahead ain't all allow allows almost
alone along alongside already also although always am amid amidst among
amongst an and another any anybody anyhow anyone anything anyway anyways
anywhere apart appear appreciate appropriate are aren't around as a's aside
ask asking associated at available away awfully b back backward backwards be
became because become becomes becoming been before beforehand begin behind
being believe below beside besides best better between beyond both brief but
by c came can cannot cant can't caption cause causes certain certainly changes
clearly c'mon co co. com come comes concerning consequently consider