Skip to content

Instantly share code, notes, and snippets.

View bvandgrift's full-sized avatar

Ben Vandgrift bvandgrift

View GitHub Profile
@bvandgrift
bvandgrift / player.rb
Created March 7, 2014 02:46
1st pass solution to bloc.io/ruby_warrior/9
class Player
MAX_HEALTH = 20
DYING_HEALTH = 10
def me
@game[:me]
end
@bvandgrift
bvandgrift / ben's 8 lb guiness chili
Created November 25, 2013 14:14
a chili recipe. made with guiness, and 8lbs of the primary ingredients
From the Dawn of Time it came.
You'll need a spice grinder, a skillet, and either a dutch oven or a really
large sauce pan with a lid. Or maybe a small stock pot.
First the Chili Powder:
makes 1/2 cup -- needless to say, you should be grinding the chilis and cumin fresh.
Grind the following dried chilis:
@bvandgrift
bvandgrift / deploy.sh
Created October 20, 2012 16:27
deploy script for pushing compiled nanoc to github pages. see http://bvandgrift.github.com/nanoc-pages-demo
#!/usr/bin/env bash
if [[ -z $1 ]]; then
echo "usage: deploy \"commit message\""
else
echo "Deploying with commit message: $1"
cd output
git add .
git commit -am "$1"
@bvandgrift
bvandgrift / xkcd-clickdrag.sh
Created September 20, 2012 13:09
lazy? i am. so here's xkcd #1110's images.
#!/bin/env bash
for x in `seq 1 20`; do
for y in `seq 1 20`; do
for n in n s; do
for e in e w; do
wget "http://imgs.xkcd.com/clickdrag/${x}${n}${y}${e}.png"
sleep 1
done
done
@bvandgrift
bvandgrift / gist:3289868
Created August 7, 2012 22:08 — forked from dayanand-sourcebits/gist:1626596
ripple.yml for multiple node
# Configure Riak connections for the Ripple library.
development:
#http_port: 8092
# pb_port: 8087
nodes:
- host: 192.168.31.2
http_port: 8092
- host: 127.0.0.1
http_port: 8091
@bvandgrift
bvandgrift / how-we-grow.rb
Created July 19, 2012 12:02
how we grow as people
expect {
touched.each { |life| experience << life unless life.empty? }
}.to change direction
@bvandgrift
bvandgrift / capybara cheat sheet
Created July 17, 2012 20:10 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@bvandgrift
bvandgrift / declarative_auth_role_seed.rb
Created July 3, 2012 15:29
seed roles for declarative_authorization based on config/authorization_rules.rb. store in lib/seeds/
Role.delete_all
role_names = Authorization::Engine.instance.roles
role_names.each { |name| Role.find_or_create_by_name!(name) }
@bvandgrift
bvandgrift / biscuit_block_testing.rb
Created September 2, 2011 01:02
looking for a better test pattern for code passed in as blocks.
# any help with the following would be awesome (@bvandgrift)
# here's the problem code (ish)
# testing the stuff in the 'chunkify' block sucks
def make_breakfast
# ...
dough_for_biscuits = DoughBro.new
dough_for_biscuits.chunkify do |chunk|
if chunk.any?
the_good_stuff = roll_dem_biscuits(chunky)
@bvandgrift
bvandgrift / add_view_paths.rb
Created November 30, 2010 16:20
prepending and appending to the view search paths in rails3
# throw something like this in an initializer
ActionController::Base.class_eval do
self.prepend_view_path "first/search/here"
# then the defaults (app/views/*)
self.append_view_path "then/search/here"
end
# an example, say you want a theme, and the name is stored in App.theme_name?
ActionController::Base.class_eval do
self.prepend_view_path "themes/#{App.theme_name}"