Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
sudo apt-get update
sudo apt-get upgrade –y
sudo apt-get install vim build-essential libssl-dev openssl curl libxml2-dev libxslt1-dev git-core mysql-server libmysqlclient-dev \
nginx monit ufw monit lynx unixodbc-dev unixodbc tdsodbc freetds-dev freetds-common libreadline5-dev libncurses5-dev libaio-dev -y
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.profile
#git prompt
PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
green=$'\e[1;32m'
magenta=$'\e[1;35m'
normal_colours=$'\e[m'
export PS1="$NM$HI\u@$HII\h:$SI\w$NM\[$magenta\]\$git_branch\[$green\] $ $IN"
function find_git_branch {
local dir=. head
@jpowers
jpowers / gist:862798
Created March 9, 2011 19:28
curl POST
curl -i -u foo@email.com:123456 -X POST -H 'Content-Type: application/xml' -d '<user><email>foo@example.com</email><postal-code>12345</postal-code></user>' http://0.0.0.0:3000/users.xml
named_scope :patient_first_name_or_last_name_or_mrn_like, lambda{|name|
Patient.first_name_or_last_name_or_mrn_like(name).proxy_options.merge({:joins =>[{:order => :patient}]})
}
@jpowers
jpowers / gist:659818
Created November 2, 2010 15:52
nav helper
def nav_item(title, url)
active_class = current_path?(url) ? ' class=\'active\'' : ''
content = '<li' + active_class + '>'
content << capture do
link_to title, url
end
content << content_tag(:span) << '</li>'
content.html_safe
end
class ContainerLabel < ActiveRecord::Base
aasm_column :state
aasm_initial_state :undownloaded
aasm_state :undownloaded
aasm_state :downloaded
aasm_event :download do
transitions :to => :downloaded, :from => :undownloaded
end
def download