This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This class gives you all the Rails 3 URL helpers, which are so | |
# unhelpfully unavailable in models, libraries, and unit tests | |
# Stick this in the library folder and get a URL with | |
# UrlHelpers.new.nameofmodel_url | |
class UrlHelpers | |
include Rails.application.routes.url_helpers | |
def initialize | |
default_url_options[:host] = case Rails.env | |
when "development" then "localhost" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in compass.rb | |
puts '>> Environment is ' + environment.to_s | |
if (environment.to_s == 'production') | |
puts '>> Disabling compass in production' | |
never_update = true | |
cache_location = '/tmp' | |
else | |
puts '>> Compass is enabled' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MY_Config extends CI_Config { | |
/** | |
* Loads in custom server-specific configurations | |
* | |
* Additional config variables set | |
* server_name - the part of the hostname to the left of '.topleveldomain.com' | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Flexible named and positional parameters for PHP | |
* | |
* To use in your function, call it like this: | |
* | |
* function your_function() { | |
* $opts = defaults(func_get_args(),array( | |
* 'some_param'=> 'default', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jinja2 import nodes | |
from jinja2.ext import Extension | |
class CaptureExtension(Extension): | |
""" | |
Generic HTML capture, inspired by Rails' capture helper | |
In any template, you can capture an area of content and store it in a global | |
variable: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine: | |
timezone: | |
Americas/New_York | |
dependencies: | |
pre: | |
- pip install -r requirements.txt | |
test: | |
override: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cd { | |
builtin cd "$@" | |
dirname=${PWD##*/} | |
if [ $dirname ] ; then | |
venv="/var/www/virtualenvs/"${dirname} | |
if [ -d $venv ] ; then | |
source ${venv}/bin/activate | |
fi | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import floor | |
indexes_of_column_breaks = {} | |
def column(current_count, total_count, num_cols): | |
cols = indexes_of_column_breaks.get((total_count, num_cols), []) | |
if not cols: | |
# Compute the indexes where a new column will start | |
cols.append(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
import ast | |
import os | |
from pyflakes import checker, messages | |
import sys | |
import fnmatch | |
from optparse import make_option | |
from django.conf import settings | |
from django.core.management.base import BaseCommand |
OlderNewer