View notable-features-of-python.md

James Powell - james@nycpython.com

itertools

  • useful for dealing with iterators & iterables
  • e.g. chain (for appending lists and tuples, instead of +)
  • also includes algorithms, e.g. takewhile (e.g. takewhile fibonacci < 50)

generators

View Gemfile
source 'http://rubygems.org'
gem 'plexus'
gem 'gratr' # dependency of plexus to visualize graphs
View sample.io
# Hello world
"Hello world!" print
# Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
bottle := method(i,
View loading.sh
#!/usr/bin/env bash
for i in {0..12}; do
if ! (($i % 4)); then
printf "\e[1K\rloading"
else
printf "."
fi
sleep 1
done && printf "\e[2K\r"
View irc.md

Register yourself

Choose a nick

/nick <newnick>

Register the nick

/msg NickServ REGISTER <password> <youremail@example.com>
View load
#!/usr/bin/env bash
# Script to load keys and (force) eject.
# If no hour value is given for the key's lifetime, it defaults to 4 hours.
#
# Usage (OS X):
# /Volumes/keys/load <optional hour value>
# <enter decryption password>
HOURS="$1"
View rails-apis.md

API Best Practices

Routes

Restricting routes

resources :zombies, only: [:index, :show]
resources :humans, except: [:destroy, :edit, :update] 
View vcr_rewinder.rb
# Require this file in spec_helper to show which cassettes are not being used
# after the test suite has run. Then you can decide if you want to delete them.
require 'vcr'
require 'set'
USED_CASSETTES = Set.new
module CassetteReporter
def insert_cassette(name, options = {})
USED_CASSETTES << VCR::Cassette.new(name, options).file
View upgrade-postgres-9.3-to-9.4.md

TL;DR

sudo pg_dropcluster 9.4 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main