Generate a new Rails project. Skip unit tests and bundle install.
rails new -T -B tdd
" Virtualenv | |
python << EOF | |
import sys, vim, os | |
ve_dir = vim.eval('$VIRTUAL_ENV') | |
ve_dir in sys.path or sys.path.insert(0, ve_dir) | |
activate_this = os.path.join(ve_dir, 'bin', 'activate_this.py') | |
if os.path.exists(activate_this): | |
execfile(activate_this, dict(__file__=activate_this)) |
#!/usr/bin/env python | |
# init post for jekyll | |
import os | |
import re | |
import datetime | |
text_tmpl = """--- | |
layout: post | |
title: %(title)s |
#!/bin/bash | |
# | |
# Author: Ilia Choly <ilia.choly@gmail.com> | |
# Year: 2014 | |
# | |
if [[ -z "$1" ]]; then | |
echo "usage: graph_memory.sh <pid>" | |
exit 1 | |
fi |
#API Best Practices | |
##Routes | |
Restricting Routes | |
resources :zombies, only: [:index, :show] | |
resources :humans, except: [:destroy, :edit, :update] | |
##Subdomain | |
Keeping our API under its own subdomain allows load balancing traffic at the DNS level. | |
resources :zombies, constraints: { subdomain: 'api' } | |
resources :humans, constraints: { subdomain: 'api' } |
This is example code for an ML response. |
:my_nice_formatted_number=>Faker::numerify('##+###-RTR#') | |
:my_nice_formatted_letters=>Faker::letterify('??/?15687??RT-??') | |
:my_nice_formatted_string=>Faker::bothify('??/##87?##R##-??') | |
Car.create( | |
:licence_plate=>Faker::bothify('####-???-##') |
import urllib | |
webpage = urllib.urlopen('http://www.baidu.com') | |
pagefile = open('baidu.html', 'w') | |
for lines in webpage.readlines(): | |
pagefile.write(lines) | |
pagefile.close() | |
webpage.close() |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
unless ARGV.size == 2 | |
puts "USAGE: ruby draw_something.rb ACKRCKOOLCWZ 5" | |
exit 1 | |
end | |
letters = ARGV[0].downcase.split(//).sort | |
length = ARGV[1].to_i | |
require 'open-uri' | |
uri = 'http://static.iminlikewithyou.com/drawsomething/wordlist.csv' |