Skip to content

Instantly share code, notes, and snippets.

View armandocanals's full-sized avatar
🦢
Build

Armando Canals armandocanals

🦢
Build
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
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')
@jurisgalang
jurisgalang / gist:663353
Created November 4, 2010 23:00
Gitisms - useful git invocations for everyday use.
# get the name of the currently checked out tag
git describe --tags --abbrev=0
# list all branches (local and remote)
git branch -a
# list all tags
git tag
# delete a tag
@rstacruz
rstacruz / 0.md
Created September 6, 2011 06:12
JST support for Sinatra

JST Support for Sinatra

Usage

class App < Sinatra::Base
  register 'sinatra/jstsupport'
  serve_jst '/jst.js'
end

This serves all JST files found in /views/**/*.jst.* as /jst.js.

@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@ggilder
ggilder / stub_method_chain.rb
Created January 17, 2012 23:05
Stub class or instance methods on anything!
class Object
def metaclass
class << self; self; end
end
def self.stub_method_chain chain, &blk
chain = chain.split('.') if chain.is_a? String
metaclass.instance_eval do
define_method chain.first do |*values|
Object.new.tap do |o|
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@ggilder
ggilder / fizz.rb
Created June 8, 2012 05:14
Fizzbuzz bitwise math
messages = [nil, "Fizz", "Buzz", "FizzBuzz"]
acc = 810092048
(1..100).each do |i|
c = acc & 3
puts messages[c] || i
acc = acc >> 2 | c << 28
end
# Explanation
#
..='cd ..'
add='git add '
admin='ssh-add && ssh admin'
b='cd ..'
be='bundle exec '
branch='git branch '
cata='cat ~/.dotfiles/bash/aliases'
cdev='cd ~/dev'
checkout='git checkout '
co='git checkout '
@capotej
capotej / fabfile.py
Created February 27, 2013 19:08
chef-solo deployer/bootstrapper
from fabric.api import *
from fabric.contrib.files import exists
from fabric.contrib.project import upload_project
## Usage
# Full run, bootstraps if needed
# fab chef:name_of_runlist,hosts=1.1.1.1 --password=1234 --user=foo
# fab chef:name_of_runlist,hosts=1.1.1.1 -i=path/to/pem --user=foo