Skip to content

Instantly share code, notes, and snippets.

@rivanenko
rivanenko / pr.md
Created June 8, 2017 07:38 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

👍 👎 ✈️ 🎨 🐻 🍺 🚲 💣 📖 💡

@svc.before do
  recursively_unpermit_hash(params)
end

def recursively_unpermit_hash(h)
  h.define_singleton_method(:permitted?) { false }
  h.each { |_, v| recursively_unpermit_hash(v) if v.is_a?(Hash) }
end

(from http://www.joyceleong.com/log/installing-phantomjs-on-ubuntu/)

  1. cd ~
  2. wget http://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
  3. sudo mv ~/phantomjs-1.9.1-linux-x86_64.tar.bz2 /usr/local/share
  4. cd /usr/local/share
  5. sudo tar xvf phantomjs-1.9.1-linux-x86_64.tar.bz2
  6. sudo ln -s /usr/local/share/phantomjs-1.9.1-linux-x86_64 /usr/local/share/phantomjs
  7. sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
  8. phantomjs --version
# 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")
@rivanenko
rivanenko / gist:2881967
Created June 6, 2012 13:49
get specializations from xlsx file
1. save .xlsx file as .csv file
2. csv = CSV.read('/home/arsan/Downloads/CSM_SPecializationTypesMay2012.csv')
3. csv.delete_at[0]
4. csv.map{|c| "'#{c[1].strip}'"}.join(", ")