Skip to content

Instantly share code, notes, and snippets.

@scootcho
scootcho / python_resources.md
Last active August 30, 2015 22:38 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@scootcho
scootcho / Gemfile
Last active September 1, 2015 22:36 — forked from cblunt/Gemfile
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@scootcho
scootcho / CarrierWave.md
Last active September 1, 2015 22:42 — forked from marcusmalmberg/CarrierWave.md
Guide to setup CarrierWave which will upload a file to Amazon S3 in production environment and use local storage in development and test

CarrierWave home

https://github.com/jnicklas/carrierwave

This example will create an uploader that will upload a file stored in a model Model. The file will be stored locally in development and test environment and will use Amazon S3 in production.

CarrierWave installation

First add the gems.

@scootcho
scootcho / ror-provisioning.sh
Last active September 9, 2015 14:25 — forked from arielcr/ror-provisioning.sh
Ruby on Rails Provisioning Script
#!/bin/bash
echo Provisioning Ruby on Rails...
echo =================================
echo - Installing dependencies
sudo apt-get update -y -qq > /dev/null
sudo apt-get install curl -y -qq > /dev/null
echo - Installing mysql server
export DEBIAN_FRONTEND=noninteractive
@scootcho
scootcho / simple-capistrano-docker-deploy.rb
Last active September 9, 2015 16:18 — forked from johnbintz/simple-capistrano-docker-deploy.rb
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@scootcho
scootcho / README.markdown
Last active September 11, 2015 20:32 — forked from greypants/README.markdown
RAILS 3: nav_link helper for adding 'selected' class to navigation elements
@scootcho
scootcho / gh-like.css
Last active September 13, 2015 06:07 — forked from somebox/gh-like.css
github markdown css+script with syntax highlighting. Works with http://markedapp.com
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
@scootcho
scootcho / vim4rails
Created September 22, 2015 18:16 — forked from wazery/vim4rails
Welcome document
Vim for Rails
==================
----------
### Brief history of Vi and Vim
Before the appearance of the famous operating system UNIX, the text editor “ed” appeared, which was written by Ken Thompson in 1971. ed is regarded as one of the oldest text editors ever, and it is also regarded as the first to implement the concept of Regular Expressions.
After that period the “ex” text editor appeared which is short for “EXtend” to add some features to “ed” and to make it simpler.

Polymorphism

Sometimes relationships need to be flexible, and that's where we look to polymorphism. Say we want to implement:

  • A Person
  • A Company
  • A PhoneNumber that can connect to a Person or a Company

At the Database Level

@scootcho
scootcho / if_less_development.md
Created September 24, 2015 01:17 — forked from jamesarosen/if_less_development.md
On Procedural Polymorphism: I like the idea of replacing ifs with Polymorphism, but I'm not quite comfortable with it yet.

Background

Cory Foy recently wrote an article entitled, Procedural Polymorphism: Is your code really telling you to use an if statement?. Corey Haines has been talking about this same topic for a while. Sandi Metz covers the topic in Practical Object-Oriented Design in Ruby. Ben Rady and Rod Coffin discussed using the Null-Object pattern instead of an if statement in Continuous Testing with Ruby, Rails, and JavaScript.

Printing in Conway's Game of Life

That is, very smart people whom I admire agree that, in general,

class DeadCell