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
RYAML = <<-BASH
function ryaml {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
};
BASH
namespace :sync do
task :db do
isolate do
invoke :environment
View osx-for-hackers.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
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"
exit
end
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: http://nokogiri.org/Nokogiri/XML/Reader.html
#
# 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
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
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"