Skip to content

Instantly share code, notes, and snippets.

class User < ActiveRecord::Base
devise :all
ActionView::TemplateError (undefined local variable or method `new_user_session_path' for #<ActionView::Base:0x243fca4>) on line #27 of app/views/shared/_header.html.haml: 24: 25: - else 26: %li= link_to "Join", join_url 27: %li= link_to "Sign In", new_user_session_path
config.gem 'devise', :version => '>=1.0.0'
config.gem 'devise'
gc my-branch                  # always work on a local branch

gca "some commit message"     # commit early, commit often

gfom && grom;                 # fetch and merge often

gca "some commit message"     # last commit before merge

git rebase -i origin/master   # interactive rebase to squash commits and make nice commit log
###
alias gs='git status'
alias gca='git commit -a -m'
alias gcm='git commit -m'
alias gb='git branch'
alias gd='git diff'
alias gfo='git fetch origin'
alias gfom='git fetch origin master'
alias grom='git rebase origin/master'
# Bash prompt showing current git branch & marking if dirty:
# Based on http://henrik.nyh.se/2008/12/git-dirty-prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
#!/bin/sh
###
# Bash shell script to convert filenames with
# uppercase + spaces to lowercase + underscores
# E.g.
# Moving "Goudy Old Style BT.ttf" to "goudy_old_style_bt.ttf"
#
# Author: Glenn Roberts
#
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# http://gist.github.com/47546
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo "*"
}
function parse_git_branch {
local branch=$(__git_ps1 "%s")
  require 'posterous'

  reader = Posterous::Reader.new("siyelo", nil, 2)

  reader.response.each do |post|
    puts post['url']
    puts post['link']
    puts post['title']

puts post['body']