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
{% for person in people %} | |
{% with profile as people.get_profile %} | |
{{ person.username }} has {{ profile.points }} points. | |
{% endwith %} | |
{% endfor %} |
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 GenericModel(models.Model): | |
model_type = models.CharField(max_length=16) | |
def __init__(self, *args, **kwargs): | |
for related_object in self._meta.get_all_related_objects(): | |
if not issubclass(related_object.model, self.__class__): | |
continue | |
self.model_type = '{0}.{1}'.format(self._meta.app_label, related_object.__class__.__name__.lower()) |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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
# On branch master | |
# | |
# Initial commit | |
# | |
# Untracked files: | |
# (use "git add <file>..." to include in what will be committed) | |
# | |
# ExperimenterInterface/ | |
# MonkeyInterfaceModules/ | |
nothing added to commit but untracked files present (use "git add" to track) |
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 | |
# <Knio> all of the things that remain constant (license, partner, whatever) should me the make class | |
# <Knio> and then when you ask it something it should return a Results object | |
# <Knio> and that object has .getTemp() or whatever | |
# <ScottG> Knio: I thought I had a good reason for setAttr but I don't see it now | |
# <Knio> so yeah, main class, SearchResults, and WeatherResults | |
# <Knio> unless searchresults is just like a list of strings, then it doesn't need to be a class | |
#TODO: Check for version numbers | |
import urllib | |
import sys |
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 | |
# Here, we are going to implement a Robot. This robot has a lot of attributes - and | |
# we are going to want to make these accessible through a public interface. | |
# CHANGE LIST: | |
# - Added an object that we are using in order to map strings to indexes | |
# in our data source. This is useful for making things a bit more user | |
# friendly in some cases. Usually with more complicated data sources. | |
# |
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 zipfile | |
class OverlayZipFile(zipfile.ZipFile): | |
""" Adds a method for overlaying a zip file with a given directory, or another | |
zip file. """ | |
def overlay(self, content): | |
""" Overlays content over the zip file represented by 'self'. | |
Receives a zip file, and write's it's entire content over the zip file which |
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 | |
# | |
# This is a small script which can be used to recursively loop through | |
# a directory and analyze every piece of audio in that directory using | |
# the impressive EchoNest API (http://the.echonest.com/). | |
# | |
# After completion, it will write a file in this script's directory | |
# which contains a mapping of every absolute file path analyzed and | |
# the related MD5 and title attributes of the resulting track. You |
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 | |
chown -R www-data:www-data /var/www | |
chmod -R 660 /var/www | |
find /var/www -type d -exec chmod 770 {} \; |
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
!!! 5 | |
//if lt IE 7 | |
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> | |
//if IE 7 | |
<html class="no-js lt-ie9 lt-ie8"> | |
//if IE 8 | |
<html class="no-js lt-ie9"> | |
// [if gt IE 8] <! | |
html(class="no-js", lang="en") | |
// <![endif] |
OlderNewer