View gist:ea505649bdaceb7b27b059cca9e24928

Anchors in Markdown

To create an anchor to a heading in github flavored markdown. Add - characters between each word in the heading and wrap the value in parens (#some-markdown-heading) so your link should look like so:

[create an anchor](#anchors-in-markdown)

View sync-postgres-mina.rb
function ryaml {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load([0]))) {|acc, key| acc[key] }' "$@"
namespace :sync do
task :db do
isolate do
invoke :environment
# Alot of these configs have been taken from the various places
# on the web, most from here
# Set the colours you can use
View pdf-fill-out-checkboxes.rb
#!/usr/bin/env ruby
# gem install pdf_forms
if ARGV.size < 2
puts "USAGE pdf-fill-out-checkboxes INPUT OUTPUT"
require 'pdf_forms'
View length.hs
main :: IO()
len :: [a] -> Int
len [] = 0
len (_:xs) = 1 + len xs
main = putStrLn $ "The length is: " ++ show (len [1, 2, 3, 4, 5])
View gist:cacf558c9eaa64f22ede
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
View xml_parser.rb
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The
# XML Reader is a good way to move a cursor through a (large) XML document fast,
# but is not as cumbersome as writing a full SAX document handler. Read about
# it here:
# Just pass the reader in this parser and specificy the nodes that you are interested
# in in a block. You can just parse every node or only look inside certain nodes.
# A small example:
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
View gist:5168464
for ip in 192.168.1.{1..255}; do curl -I http://$ip:3000 --connect-timeout 1 --silent > /dev/null && echo $ip; done
View .bash_aliases
# rails
alias r=rails
alias rdtp="rake db:test:prepare"
# git
alias gs="git status"
alias gl="git log"
alias ga="git add"
alias gd="git diff"
alias gco="git commit"