Skip to content

Instantly share code, notes, and snippets.

@sunblaze
sunblaze / gist:c82cf7ff19a532ef17ae
Last active August 29, 2015 14:21
You can't combine them

You can't combine them

@sunblaze
sunblaze / cached.rb
Last active December 12, 2015 09:09 — forked from practicingruby/cached.rb
module Cached
def cache(*method_names)
method_names.each do |m|
original = instance_method(m)
results = {}
define_method(m) do |*a|
results[a] ||= original.bind(self).call(*a)
end
end
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/iTerm2-1_0_0_20120726.zip'
md5 '596c8ff70a836f67ee3197bb60cf92b3'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install
@sunblaze
sunblaze / .bash_profile
Created October 5, 2012 00:36
My Simple .bash_profile
# Loaded when a new shell is started
# Put environment changes in .bashrc instead, unless it's only for new shells, and not sub-shells
source ~/.bashrc
@sunblaze
sunblaze / rspec-syntax-cheat-sheet.rb
Created May 30, 2012 18:50 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@sunblaze
sunblaze / deploy.rb
Created December 2, 2011 21:14
Double bundle deploy. Nice trick to run two seperate Gemfiles for one project and deploy it with style.
require "bundler/capistrano"
after "deploy:finalize_update", "bundle:jruby_install"
namespace :bundle do
desc "Install bundle environment for jruby"
task :jruby_install do
old_current_release = fetch(:current_release)
set :bundle_dir, File.join(fetch(:shared_path), 'jruby_bundle')
set :current_release, File.join(fetch(:current_release), 'lib/jruby_daemon')
install