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
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 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
<!DOCTYPE html> | |
<html> | |
<head data-gwd-animation-mode="quickMode"> | |
<title>Index</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="generator" content="Google Web Designer 1.0.0.924"> | |
<style type="text/css"> | |
html, body { | |
width: 100%; |
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
class MyModel(PolymorphicModel): | |
@property | |
def driver(self): | |
if self.is_departure: return self.delivery_driver | |
else: return self.collection_driver | |
@driver.setter | |
def driver(self, value): | |
if self.is_departure: self.delivery_driver = value | |
else self.collection_driver = value |
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
""" | |
adminreverse from here http://djangosnippets.org/snippets/2032/ | |
changed for working with ForeignKeys | |
Partially Fixed for Django 1.6 by @andybak | |
Fully Fixed for Django 1.6 by @luto | |
Fieldset support added by @andybak | |
reverseadmin | |
============ | |
Module that makes django admin handle OneToOneFields in a better way. |
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/python | |
import re, urllib, urllib2 | |
class Spreadsheet(object): | |
def __init__(self, key): | |
super(Spreadsheet, self).__init__() | |
self.key = key | |
class Client(object): |
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/sh | |
# Script to install, run, and open logcat for a Unity Android App. | |
# I needed this as one of my libraries has a critical post-build script so I can't use "Build and Run" anymore - this is the "and Run" part. | |
# Be sure to update these variables to match your app's publishing/build settings: | |
APK_PATH='builds/android/basecode.apk' | |
BUNDLE_ID='com.eliotlash.basecode' | |
alias unilogcat='adb logcat|egrep "Unity"' | |
adb install -r "${APK_PATH}" && adb logcat -c && adb shell am start -n "${BUNDLE_ID}/com.unity3d.player.UnityPlayerNativeActivity" && echo 'DONE, LOG:' && unilogcat |
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
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 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
// When creating shaders for Lightweight Pipeline you can you the ShaderGraph which is super AWESOME! | |
// However, if you want to author shaders in shading language you can use this simplified version as a base. | |
// Please not this should be only use for reference only. | |
// It doesn't match neither performance not feature completeness of Lightweight Pipeline Standard shader. | |
Shader "LightweightPipeline/Physically Based Example" | |
{ | |
Properties | |
{ | |
// Specular vs Metallic workflow | |
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEngine; | |
using Object = UnityEngine.Object; | |
public class MaterialGradientDrawer : MaterialPropertyDrawer { | |
private static Dictionary<(int, string), Gradient> knownGradients = new Dictionary<(int, string), Gradient>(); |