Skip to content

Instantly share code, notes, and snippets.

View djm's full-sized avatar

Darian Moody djm

View GitHub Profile
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@coordt
coordt / fabfile.py
Created December 1, 2010 12:51
A Fabric fabfile that allows you to check which packages are not like the others on a set of servers.
from __future__ import with_statement
from fabric.api import env, run, settings, hide
from fabric.decorators import hosts, runs_once
venv = "/home/websites/.virtualenvs/twtv3/"
env.user = 'webdev'
env.hosts = [
'192.168.1.10',
'192.168.1.11',
alias gs='git status'
alias gai='git add --interactive'
alias gsvn='git svn'
alias gsup='gsvn fetch && gsvn rebase'
alias gsp='gsup && gsvn dcommit'
alias gf='git fetch'
alias gr='git rebase'
alias gp='gup && git push'
alias gff='git flow feature'
alias gfr='git flow release'
@codeinthehole
codeinthehole / curried_subclass.py
Created September 9, 2011 08:38
Lightweight subclassing using curry
def curry(f, *args, **kwargs):
def curried(*more_args, **more_kwargs):
return f(*(args+more_args), **dict(kwargs, **more_kwargs))
return curried
class Person(object):
def __init__(self, name, gender):
self.name = name
self.gender = gender
@bradland
bradland / ssh-known-hosts-mgmt.sh
Last active April 4, 2023 21:21
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts
# Scan known hosts
ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@benbarnett
benbarnett / GroupsToPNG.jsx
Created January 17, 2012 15:19
Groups to PNG Photoshop Script
#target photoshop
var sizes = {
'xlarge': [1490, 730],
'large': [1160, 568],
'medium': [890, 436],
'small': [760, 372]
};
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active June 6, 2024 22:59
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@AndrewIngram
AndrewIngram / gist:3231297
Created August 1, 2012 22:33
supervisor script
;[program:andrewingram-gunicorn]
;command=/var/www/andrewingram.net/bin/gunicorn_django /var/www/andrewingram.net/src/andrewingram/andrewingram/settings.py
;directory=/var/www/andrewingram.net
;logfile=/var/www/andrewingram.net/log/supervisor.log
;user=deployer
;autostart=true
;autorestart=true
;redirect_stderr=True
[program:andrewingram-uwsgi]
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: