I hereby claim:
- I am bryckbost on github.
- I am bryckbost (https://keybase.io/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:
I hereby claim:
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. |
# env.rb | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end | |
Download chromedriver from http://code.google.com/p/selenium/downloads/list | |
mv chromedriver to /usr/local/bin so it's in your path. |
require 'benchmark' | |
@string = "this is a long string that I want 123 to appear in" | |
Benchmark.bmbm(6) do |x| | |
x.report("String#match") do | |
1_000_000.times do | |
@string.match(/123/) | |
end |
require 'benchmark' | |
@string = "this is a long string that I want 123 to appear in" | |
Benchmark.bmbm(6) do |x| | |
x.report("String#match") do | |
100_000.times do | |
@string.match(/123/) | |
end | |
end |
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}) | |
end.join("\n").html_safe | |
end | |
end |
#!/bin/sh | |
echo "What should the Application be called (no spaces allowed e.g. GCal)?" | |
read inputline | |
name=$inputline | |
echo "What is the url (e.g. https://www.google.com/calendar/render)?" | |
read inputline | |
url=$inputline |
class Plant | |
include MongoMapper::Document | |
key :weight, Float, :numeric => true | |
end | |
p = Plant.new(:weight => 'String') | |
p.weight # => 0.0 | |
<!DOCTYPE> | |
<html> | |
<head> | |
<script type="application/javascript"> | |
// https://developer.mozilla.org/en/Canvas_tutorial | |
function draw() { | |
var canvas = document.getElementById('canvas'); | |
if (canvas) { |
require "rubygems" | |
require 'scrobbler' | |
require 'tinder' | |
user = Scrobbler::User.new('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.name} (#{t.playcount})\n" } | |
campfire = Tinder::Campfire.new('subdomain') |