Skip to content

Instantly share code, notes, and snippets.

View lenage's full-sized avatar
:octocat:
Focusing

Yuan He lenage

:octocat:
Focusing
View GitHub Profile
@kneath
kneath / ._what.md
Created December 4, 2009 18:23
Badass git pull alias (up) to show commit log that just got pulled in addition to changes

Badass git pull alternative

Add this little snippet to your ~/.gitconfig and it amps up your git pull by means of git up

  1. Adds in a list of the commits you're pulling down
  2. Auto-prunes remote branches
  3. Defaults to pull --rebase - gets rid of unnecessary merge commits. If you don't know what rebase does, this is probably safe for you. If you know what rebase does, you should know where this will not be safe for you.

Scott Chacon and Ryan Tomayko basically figured out how to do this and I am stealing all of the credit.

# Newbie Programmer
def factorial(x)
if x == 0
return 1
else
return x * factorial(x - 1)
end
end
puts factorial(6)
puts factorial(0)
@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')
@jgarber623
jgarber623 / template.html
Created July 19, 2010 03:38
A sample (X)HTML5 template for personal use
<!DOCTYPE html>
<html lang="en" id="example-com">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="profile" href="http://microformats.org/profile/hcard" />
<link rel="stylesheet" media="screen" href="http://yui.yahooapis.com/3.1.1/build/cssreset/reset-min.css" />
<link rel="stylesheet" media="screen" href="stylesheets/screen.css" />
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
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")
@bryanl
bryanl / tmux.conf
Created November 30, 2010 05:17
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
@diago
diago / capybara cheat sheet
Created April 5, 2011 14:42 — forked from zhengjia/capybara cheat sheet
Capybara Cheatsheet
=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_or_button('Link Text') # Click either a link or a button
click('Button Value')
@schleg
schleg / 01. Gemfile
Created May 26, 2011 17:26
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"