This file contains hidden or 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
class FooAdmin(ModelAdmin): | |
… | |
def lookup_allowed(self, key, value): | |
# NOTE: Django 1.2.5 changed the call signature to add the value | |
# Django 1.2.4 restricted the list of allowed lookups to only those | |
# specified in list_filter or date_hierarchy, which doesn't help when | |
# we need to filter on a list with thousands of options. We'll | |
# override that to allow the few which we actually use: | |
if key in ('related__pk', 'related__custom_field'): | |
return True |
This file contains hidden or 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 | |
""" | |
Use pip to get a list of local packages to check against one or more package | |
indexes for updated versions. | |
""" | |
import pip | |
import sys, xmlrpclib | |
from cStringIO import StringIO | |
from distutils.version import StrictVersion, LooseVersion |
This file contains hidden or 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/python | |
from sorl.thumbnail.conf import settings | |
from sorl.thumbnail.base import ThumbnailBackend | |
FORMAT_DICT = { | |
'png': 'PNG', | |
'jpeg': 'JPEG', | |
'jpg': 'JPEG', |
This file contains hidden or 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
((window, document, requirements, callback) -> | |
getScript = (url, callback) -> | |
script = document.createElement('script') | |
script.src = url | |
head = document.documentElement.childNodes[0] | |
done = false | |
script.onload = script.onreadystatechange = -> | |
if not done and (not (readyState = @readyState) or readyState == 'loaded' or readyState == 'complete') | |
done = true | |
callback() |
This file contains hidden or 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
<!-- | |
Where {% jsmin %}{% endjsmin %} is a django template tag that | |
uses a Python port of Crockford's JSMin: | |
* http://www.crockford.com/javascript/jsmin.html | |
* https://gist.github.com/1b085c39b85347255557 | |
Where {% mogrify %} is a custom template tag that generates a | |
URL with a resize command in the filename (semi-compatible with | |
ImageMagick mogrify) that is caught by a 404-handling script | |
running on the media server. A special hashed key is generated |
This file contains hidden or 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
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
[CustomEditor (typeof(TriggerContainer))] | |
public class TriggerContainerEditor : Editor | |
{ | |
private SerializedObject obj; |
This file contains hidden or 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
Shader "Tri-Planar World" { | |
Properties { | |
_Side("Side", 2D) = "white" {} | |
_Top("Top", 2D) = "white" {} | |
_Bottom("Bottom", 2D) = "white" {} | |
_SideScale("Side Scale", Float) = 2 | |
_TopScale("Top Scale", Float) = 2 | |
_BottomScale ("Bottom Scale", Float) = 2 | |
} | |
This file contains hidden or 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
# Requires https://github.com/andybak/codebase-python-api-client.git | |
import csv | |
from codebase.client import CodeBaseAPI | |
codebase = CodeBaseAPI(username='account name/user name', apikey='your key here', project='project name') | |
tickets = [codebase.ticket(ticket_id=x) for x in range(1,151)] | |
f = open('tickets.csv', 'wb') | |
tickets = [x['ticket'] for x in tickets if x.get('ticket')] |
This file contains hidden or 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
// ------------------------------------------------------------------ | |
// Fog helpers | |
// | |
// multi_compile_fog Will compile fog variants. | |
// UNITY_FOG_COORDS(texcoordindex) Declares the fog data interpolator. | |
// UNITY_TRANSFER_FOG(outputStruct,clipspacePos) Outputs fog data from the vertex shader. | |
// UNITY_APPLY_FOG(fogData,col) Applies fog to color "col". Automatically applies black fog when in forward-additive pass. | |
// Can also use UNITY_APPLY_FOG_COLOR to supply your own fog color. | |
// In case someone by accident tries to compile fog code in one of the g-buffer or shadow passes: |
This file contains hidden or 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
# If your test settings file doesn't import any other settings file | |
# then you can use the function directly: | |
def prevent_tests_migrate(db): | |
import django | |
from django.db import connections | |
from django.db.migrations.executor import MigrationExecutor | |
django.setup() | |
ma = MigrationExecutor(connections[db]).loader.migrated_apps | |
return dict(zip(ma, ['{a}.notmigrations'.format(a=a) for a in ma])) |
OlderNewer