Skip to content

Instantly share code, notes, and snippets.

View themartorana's full-sized avatar

Dave Martorana themartorana

View GitHub Profile
@themartorana
themartorana / hae.js
Created February 13, 2011 18:07
Default JS file
//= require "vendor/prototype.s2"
HAE = {
}
//= require "hae/attorney"
//= require "hae/hiringagency"
document.observe('dom:loaded', function() {
Element.addMethods({
kicker -e "sprocketize -C /Users/dave/code/Python/django-sites/hae/content/js -I hae -I vendor hae.js > /Users/dave/code/Python/django-sites/hae/content/js/sprockets.js" /Users/dave/code/Python/django-sites/hae/content/js
import subprocess, shlex
import os
def sprocketize():
try:
import shlex, subprocess
js_path = os.path.abspath(os.path.join(os.getcwd(), '../content/js'))
sprocketize = "sprocketize -C %s -I hae -I vendor hae.js > %s/sprockets.js" % (
js_path,
js_path
#
#
def create_table_for_unrelated_model(model, database_name):
from django.db import connections, transaction
from django.core.management.sql import custom_sql_for_model
from django.core.management.color import no_style
connection = connections[database_name]
cursor = connection.cursor()
@themartorana
themartorana / gist:851307
Created March 2, 2011 17:18
Get request.context and request.template support back in TestCase using Jinja2
from jinja2 import Template as Jinja2Template
from django.test import signals
#note - this code can be run only once
ORIGINAL_JINJA2_RENDERER = Jinja2Template.render
def instrumented_render(template_object, *args, **kwargs):
context = dict(*args, **kwargs)
signals.template_rendered.send(
sender=template_object,
template=template_object,
@themartorana
themartorana / gist:976694
Created May 17, 2011 15:29
/etc/rc.local
We couldn’t find that file to show.
@themartorana
themartorana / gist:976705
Created May 17, 2011 15:32
/etc/cron.d/initialrunner
We couldn’t find that file to show.
@themartorana
themartorana / build.py
Created May 17, 2011 15:54
build.py
import os, sys
import datetime
import base64
import cloudservers
import cloudlb
import urllib2
#import paramiko
from time import sleep
@themartorana
themartorana / gist:976701
Created May 17, 2011 15:31
/etc/rc.local.stage1
#!/bin/bash -e
if [ -f /etc/cron.d/initialrunner ]; then
    rm /etc/cron.d/initialrunner
fi
# Update the server
apt-get update -y
aptitude -yf full-upgrade
aptitude install -y git
@themartorana
themartorana / gist:1339600
Created November 4, 2011 15:34
Settings for Sublime Text 2
/* User File Prefs */
{
"auto_match_enabled": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"font_face": "Monaco",
"font_size": 12,
"scroll_past_end": true,
"tab_size": 4,