Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bryckbost on github.
  • I am bryckbost ( on keybase.
  • I have a public key whose fingerprint is C96A 6B30 7473 6507 C1D2 8BE8 AAB0 83D9 6329 45C2

To claim this, I am signing this object:

DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => 'Text' }' instead.
bryckbost / gist:1040263
Created June 22, 2011 14:54
Capybara 1.0 and Chrome
# env.rb
Capybara.register_driver :selenium do |app|, :browser => :chrome)
Download chromedriver from
mv chromedriver to /usr/local/bin so it's in your path.
bryckbost / gist:947005
Created April 28, 2011 18:48
Regex benchmark
require 'benchmark'
@string = "this is a long string that I want 123 to appear in"
Benchmark.bmbm(6) do |x|"String#match") do
1_000_000.times do
bryckbost / gist:945168
Created April 27, 2011 20:46
match versus =~.rb
require 'benchmark'
@string = "this is a long string that I want 123 to appear in"
Benchmark.bmbm(6) do |x|"String#match") do
100_000.times do
def csrf_meta_tags
if protect_against_forgery?
[].tap do |tags|
tags << tag('meta', {:name => 'csrf-param', :content => request_forgery_protection_token})
tags << tag('meta', {:name => 'csrf-token', :content => form_authenticity_token})
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
echo "What is the url (e.g."
read inputline
class Plant
include MongoMapper::Document
key :weight, Float, :numeric => true
p = => 'String')
p.weight # => 0.0
bryckbost / canvas_test.html
Created June 8, 2010 18:20
Simple canvas example to draw a rectangle with a pointed end
<script type="application/javascript">
function draw() {
var canvas = document.getElementById('canvas');
if (canvas) {
require "rubygems"
require 'scrobbler'
require 'tinder'
user ='nsain')
output = "#{user.username}'s Top 5 Weekly Artists\n" + ("-" * (user.username.length + 30)) + "\n"
user.weekly_artist_chart[0..4].each {|t| output += "#{} (#{t.playcount})\n" }
campfire ='subdomain')