Skip to content

Instantly share code, notes, and snippets.

@danmcclain
danmcclain / hack.sh
Created April 17, 2012 23:39 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@danmcclain
danmcclain / pair.md
Created April 10, 2012 16:25 — forked from wm/pair.md
TMUX Pairing

SSH setup for remote pairing

If Animal and Fozzie wanted to pair on Animals machine and they both have access to shared.muppets.com then they could use the following setup

  • Animal will have the following in ~/.ssh/config
Host tunnel_from_muppets
  Hostname space.muppets.com
 RemoteForward 1235 localhost:22
@user = User.new(:email => 'test@example.com', :name => 'John Wayne')
string = "hello there {{user.email}} how are you {{user.name}}"
string.gsub(/\{\{(.+?)\}\}/) do |s|
eval("@#{$1}")
end
# post.rb
class Post
include DataMapper::Resource
property :id, Serial
property :title, String, :required => true
property :body, Text, :required => true
property :slug, String
before :save, :make_slug
@danmcclain
danmcclain / delayed_devise_mailer.rb
Created October 20, 2011 11:52 — forked from robotmay/delayed_devise_mailer.rb
A quick hack to make Devise send its confirmation/password reset/unlock emails via delayed_job. Chuck the following in a file under config/initializers
module Devise
module Models
module Confirmable
handle_asynchronously :send_confirmation_instructions
end
module Recoverable
handle_asynchronously :send_reset_password_instructions
end
@danmcclain
danmcclain / given_when_then-example_spec.rb
Created September 27, 2011 16:40 — forked from bcardarella/given_when_then-example_spec.rb
Given, When, Then pattern applied to Capybara Request DSL
require 'spec_helper'
feature 'Report is Now'
scenario 'with valid attributes' do
Given 'I am authenticated' do
@user = authenticate(create(:user))
end
And 'I have no reports' do
@user.reports.should be_empty
end
@danmcclain
danmcclain / nginx
Created August 27, 2011 12:14 — forked from jordanorelli/nginx
nginx init.d script
#!/usr/bin/env bash
# Adapted from the book "Nginx HTTP Server", by Clement Nedelcu.
# Original Author: Ryuan Norbauer http://norbauerinc.com
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: Clement Nedelcu http://cnedelcu.blogspot.com/
# Modified: Jordan Orelli http://jordanorelli.com/
# source: https://gist.github.com/1161075
# Corresponds with the following compile-time options:
@danmcclain
danmcclain / capistrano_database_yml.rb
Created August 8, 2011 10:22 — forked from weppos/capistrano_database_yml.rb
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors