Skip to content

Instantly share code, notes, and snippets.

#A little script to convert all your .erb views to .haml using html2haml, which is included with Haml installation.
#Just drop this in your rails root folder and run it.
#
# Original Author: http://snippets.dzone.com/posts/show/5449
#
# GlennR: 2009 09 09 - Improved output. (I didnt have hpricot installing and the script wasnt telling me otherwise!)
#
class ToHaml
def initialize(path)
### RAILS SHORTCUT GLORY
#
# printf "\033[0m0 All attributes off\033[0m\n"
# printf "\033[1m1 Bold\033[0m\n"
# printf "\033[4m4 Underline\033[0m\n"
# printf "\033[5m5 Blink\033[0m\n"
# printf "\033[7m7 Invert\033[0m\n"
# printf "\033[8m8 Hide\033[0m8 = Hide\n"
# printf "\033[30m30 Black\033[0m30 = Black\n"
export EDITOR='mate -w'
export GIT_EDITOR='mate -wl1'. #This instructs TextMate to open with the caret at line 1 rather than where it last was.
#!/bin/sh
# Install ImageMagick on Snow Leopard: by kain, improved by mislav and samsoffes
# Updated by glenn roberts to include libiconv, and the latest stable ImageMagick
#
# http://www.icoretech.org/2009/08/install-imagemagick-in-leopard-snow-leopard/
# Work with 64bit kernel mode
set -e
PREFIX=/usr/local
alias gphm='git push heroku master'
alias hmig='heroku rake db:migrate'
alias hlog='heroku logs'
alias hopen='heroku open'
  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']

# 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")
#!/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
#
# 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)]/"
}
###
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'