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 django.views.generic.base import TemplateResponseMixin | |
from django.views.generic.base import View | |
class SomeFormView(TemplateResponseMixin, View): | |
template_name = 'some_form.html' | |
def get(self, request): | |
form = SomeForm() | |
return self.render_to_response({ |
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
:%s/${\([^}]*\)}/{{ \1 }}/g | |
:%s/% if\([^:]*\):/{% if\1 %}/g | |
:%s/% endif/{% endif %}/g | |
:%s/% else:/{% else %}/g | |
:%s/% for\([^:]*\):/{% for\1 %}/g | |
:%s/% endfor/{% endfor %}/g |
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
# Ruby style string interpolation with a giant bag of evil python. | |
import inspect | |
class __(str): | |
def __init__(self, other): | |
super(__, self).__init__(other) | |
def __invert__(self): | |
frame = inspect.currentframe() |
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
#!/bin/bash | |
# run if user hits control-c | |
control_c() | |
{ | |
echo "Oh no, exiting!" | |
for pid in $(cat gunicorn.pid) | |
do | |
echo "killing $pid" | |
kill -SIGKILL $pid | |
done |
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
import unittest | |
from pyramid import testing | |
from paste.deploy.loadwsgi import appconfig | |
from webtest import TestApp | |
from mock import Mock | |
from sqlalchemy import engine_from_config | |
from sqlalchemy.orm import sessionmaker | |
from app.db import Session |
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
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
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 random | |
import time | |
import platform | |
snowflakes = {} | |
try: | |
# Windows Support |
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 bash | |
while :; do | |
find "$PWD" -name '*.less' | while read line; do | |
REPLACE=`echo $line | sed "s|\.less|\.css|"` | |
mt1=$(stat -c %Y $line) | |
mt2=$(stat -c %Y $REPLACE) | |
if [ "$mt1" -gt "$mt2" ]; then |
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
/* | |
* Copyright 2011 Twitter, Inc. | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
OlderNewer