Skip to content

Instantly share code, notes, and snippets.


Bailey Stoner monokrome

Block or report user

Report or block monokrome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:670310
{% for person in people %}
{% with profile as people.get_profile %}
{{ person.username }} has {{ profile.points }} points.
{% endwith %}
{% endfor %}
View gist:748217
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__):
self.model_type = '{0}.{1}'.format(self._meta.app_label, related_object.__class__.__name__.lower())
monokrome / gist:798921
Created Jan 27, 2011
GitHub Global GitIgnore
View gist:798921
# Compiled source #
# Packages #
View gist:798937
# 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)
monokrome / gist:902933
Created Apr 5, 2011
A basic command-line weather interface in Python
View gist:902933
# <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
monokrome /
Created Apr 5, 2011
A basic idea of how you can implement factories in Python, and what they are used for.
#!/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.
# - 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.
monokrome /
Created May 14, 2011
A zip file which happens to let content overlay it's files. Use with a dash of StringIO for grand results.
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
monokrome /
Created Jun 7, 2011
Recursively loops through a directory (./audio) looking for audio and analyzes it with the EchoNest API.
#!/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 (
# 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
monokrome /
Created Jun 19, 2011
Fixes permissions for /var/www on my Ubuntu machine
#!/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 {} \;
View layout2.jade
!!! 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]
You can’t perform that action at this time.