Skip to content

Instantly share code, notes, and snippets.

View gsiegman's full-sized avatar

Glenn Siegman gsiegman

  • Wisconsin
  • 11:36 (UTC -06:00)
View GitHub Profile
'use strict';
var dashboardApp = angular.module('dashboardApp', [
'ngRoute',
'dashboardControllers'
]);
dashboardApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.when('/index', {
from itertools import combinations
my_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l']
num_combs = len([i for i in combinations(my_list, r=3)])
print num_combs
@gsiegman
gsiegman / code
Created November 20, 2012 05:35
Why?
# models
class Track(models.Model):
id = models.IntegerField(primary_key=True)
recording = models.IntegerField()
tracklist = models.ForeignKey(Tracklist, db_column="tracklist", related_name="tracks")
position = models.IntegerField()
name = models.CharField(max_length=255, unique=True)
artist_credit = models.ForeignKey(
ArtistCredit,
@register.filter()
def currency(value):
symbol = getattr(settings, 'CURRENCY_SYMBOL', '$')
thousand_sep = getattr(settings, 'THOUSAND_SEPARATOR', ',')
decimal_sep = getattr(settings, 'DECIMAL_SEPARATOR', '.')
intstr = str(int(value))
f = lambda x, n, acc=[]: f(x[:-n], n, [(x[-n:])]+acc) if x else acc
intpart = thousand_sep.join(f(intstr, 3))
return "%s%s%s%s" % (symbol, intpart, decimal_sep, ("%0.2f" % value)[-2:])
<input name="" type="text" class="inputbox" value="Search" onblur=
"this.value=(this.value=='') ? 'Search' : this.value;" onfocus=
"this.value=(this.value=='Search') ? '' : this.value;" />
#Given a variable, x, that stores
#the value of any decimal number,
#write Python code that prints out
#the nearest whole number to x.
#You can assume x is not negative.
# x = 3.14159 -> 3 (not 3.0)
# x = 27.63 -> 28 (not 28.0)
@gsiegman
gsiegman / gist:1918836
Created February 26, 2012 20:27
Rounding with string homework
#Given a variable, x, that stores
#the value of any decimal number,
#write Python code that prints out
#the nearest whole number to x.
#You can assume x is not negative.
# x = 3.14159 -> 3 (not 3.0)
# x = 27.63 -> 28 (not 28.0)
@gsiegman
gsiegman / Procfile
Created February 26, 2012 02:52
My Heroku Procfile
web: python django_project/manage.py collectstatic --noinput; bin/gunicorn_django --workers=3 --bind=0.0.0.0:$PORT django_project/settings.py
@gsiegman
gsiegman / gist:1604586
Created January 13, 2012 03:43
Naughty Words
NAUGHTY_WORDS = [
"ass", "asswipe", "asshole", "anal", "azz", "bastard", "BDSM", "bitch", "biotch",
"beetch", "boob", "b00b", "blowjob", "boxmunching", "bullshita", "butthead",
"butthole", "clit", "cock", "cum", "cunnilingus", "cunt", "dick", "dike", "dildo",
"dink", "dong", "douche", "dumbass", "dung", "fag", "faggot", "fart", "fop", "fuck",
"fuk", "fing", "gangbang", "gay", "go black", "homo", "goddamn", "hoochie", "hooters",
"horny", "horney", "jacking", "jackoff", "jerking", "jism", "knockers", "kunt", "lesbo",
"manmeat", "manwich", "masturbate", "masterbate", "moron", "muff", "muffdive", "muncher",
"nigger", "nympho", "orgy", "pecker", "penus", "penis", "piss", "prick", "pussy", "rectum",
"rectal", "scrotum", "schlong", "shit", "slit", "slut", "sob", "tits", "twat", "whore",
@gsiegman
gsiegman / gist:1504249
Created December 21, 2011 02:15
Python List of Noise Words
NOISE_WORDS = [
"a","about","above","all","along","also","although","am","an","any","are","aren't",
"as","at","be","because","been","but","by","can","cannot","could","couldn't",
"did","didn't","do","does","doesn't","e.g.","either","etc","etc.","even","ever",
"for","from","further","get","gets","got","had","hardly","has","hasn't","having","he",
"hence","her","here","hereby","herein","hereof","hereon","hereto","herewith","him",
"his","how","however","I","i.e.","if","into","it","it's","its","me","more","most",
"mr","my","near","nor","now","of","on","onto","other","our","out","over","really",
"said","same","she","should","shouldn't","since","so","some","such","than","that",
"the","their","them","then","there","thereby","therefore","therefrom","therein",