Skip to content

Instantly share code, notes, and snippets.

View benjaminws's full-sized avatar

Benjamin W. Smith benjaminws

View GitHub Profile
@benjaminws
benjaminws / faster.sh
Created March 3, 2012 16:51
faster/slower tests for models
bsmith@bsmith-laptop!1264
-> time rspec -fd spec/models
Planet
Age
records the year of its birth
knows it's age
Size
has a size of 100 when width and height are 10
@benjaminws
benjaminws / vi
Created February 1, 2012 00:02
vi
-> /usr/bin/vi --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 6 2011 10:36:56)
@benjaminws
benjaminws / bounce_shoes.rb
Created January 22, 2012 21:24
Learning ruby with shoes!
# KBounce clone
# Setup a basic canvas, 600x400, not resizable
Shoes.app :width => 600, :height => 400, :resizable => false do
background black
# Put our vertical and horizontal baracades in a list
@linesv = []
@linesh = []
[alias]
serve = daemon --reuseaddr --verbose --base-path=. --export-all ./.git
@benjaminws
benjaminws / role_copy.rb
Created December 2, 2011 16:04
knife role copy
require 'chef/knife'
class Chef
class Knife
class RoleCopy < Knife
deps do
require 'chef/role'
require 'chef/json_compat'
end
@benjaminws
benjaminws / save_roles.sh
Created December 1, 2011 18:01
Save roles
#!/bin/bash
# Get all your roles, save them to disk.
set -e
KNIFE=/usr/bin/knife
SAVE_DIR=~/chef-repo/roles
for role in `$KNIFE role list`; do
$KNIFE role show -F json $role > $SAVE_DIR/$role.json;
@benjaminws
benjaminws / save_databags.sh
Created December 1, 2011 18:01
save databags to disk
#!/bin/bash
# Get all your data bags, save them to disk
set -e
KNIFE=/usr/bin/knife
SAVE_DIR=~/chef-repo/data_bags
for bag in `$KNIFE data bag list`; do
for item in `$KNIFE data bag show $bag`; do
@benjaminws
benjaminws / rec.txt
Created November 18, 2011 21:39
yep
You and I haven’t spoke before, but I am a representative of XXX, Inc.
Earlier today I took part in a conversation with an individual who suggested that we have a chat. This individual thinks you might be well suited for a few opportunities that my company currently represents, but first things first I wanted to have a quick chat with you to introduce myself, and learn more about youpr current employment situation. Please feel free to respond to this email, or call me at XXXXXXXXXX so we can have a brief discussion.
I look forward to hearing from you soon.
@benjaminws
benjaminws / default.rb
Created November 7, 2011 21:08
after_changed
template "/opt/local/etc/myservice.cfg" do
source "myservice.cfg.erb"
owner "user"
after_changed "some_command"
end
>>> a = ["a", "b" "c"]
>>> a
['a', 'bc']