Skip to content

Instantly share code, notes, and snippets.

@bf4
bf4 / 42-things.md
Last active August 29, 2015 14:12 — forked from SabretWoW/42-things.md

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

# Natively, Enumerators get JSONized like "#<Enumerator::Lazy:0x007f8714807080>", or they explode, either of which is a problem.
# We want them to make an array, and do it lazily so we don't have to keep the items in memory!
class Enumerator
def to_json(state)
state.depth += 1
string = "[\n"
first_item = true
self.each do |item|
@bf4
bf4 / gist:f965dbcc7573c1474187
Last active August 29, 2015 14:26 — forked from nateberkopec/gist:11dbcf0ee7f2c08450ea
RubySpec is dead, long live RubySpec!

Last night, Brian Shirai unilaterally "ended" the RubySpec project, a sub-project of Rubinius (the alternative Ruby implementation which Brian was paid to work on full-time from 2007 to 2013). The blog post describing his reasons for "ending" the project led to a big discussion on Hacker News.

When a single, competing Ruby implementation tells that you its test suite is the One True Way, you should be skeptical. Charles Nutter, Ruby core committer and JRuby head honcho, spent a lot of time last night on Twitter talking to people about what this decision means. He's probably too busy and certainly too nice of a guy to write about what is a political issue in the Ruby community, so I'm going to do it on behalf of all the new or intermediate Rubyists out there that are confused by Brian's decision and what it me

provision_list:
############################################
"staging-apps+search":
############################################
env: staging
count: 1
roles:
master: yes # has all the background services (cron)
@bf4
bf4 / notes.txt
Last active August 31, 2015 03:08
ExceptionController and testing FooController.action(:show)
https://github.com/rails/rails/blob/master/actionpack/test/controller/new_base/bare_metal_test.rb
module BareMetalTest
class BareController < ActionController::Metal
def index
self.response_body = "Hello world"
@bf4
bf4 / tinyurl.rb
Created July 26, 2010 18:31 — forked from woods/tinyurl.rb
#!/usr/bin/env ruby
#
# A complete URL-shortening web application, written in Ruby/Sinatra. Run it
# from the command line, and then visit http://localhost:4567/
#
# Or to run it under apache/passenger, you'll need a config.ru file with the
# following contents:
#
# require 'tinyurl'
# run Sinatra::Application
@bf4
bf4 / gravatar.sh
Last active September 9, 2015 22:34
gravatar
ruby -rdigest/md5 -e '%x[ open "http://www.gravatar.com/#{Digest::MD5.hexdigest(ENV["EMAIL"].downcase)}.json"]'
ruby -rdigest/md5 -e '%x[ open "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(ENV["EMAIL"].downcase)}.jpg?size=1024"]'
@bf4
bf4 / most-active-users-on-github-2015.md
Last active September 16, 2015 03:43 — forked from eddiejaoude/most-active-users-on-github-2015.md
Most active users on GitHub 2015

This is the top 1000 users on GitHub

Where are you on here?

For the first 6 months of 2015 (Jan - June).

Query used on Google's BigQuery with GitHubArchive Data

SELECT actor.login as user, COUNT(*) as total FROM (