Skip to content

Instantly share code, notes, and snippets.

In [1]: a = [1,2,3]
In [2]: b = a
In [3]: b
Out[3]: [1, 2, 3]
In [4]: b.append(4)
In [5]: a
(gizmag)jacob [master] ~/p/gizmag $ gunicorn gizmag.wsgi:application
2013-09-24 16:38:23 [73705] [INFO] Starting gunicorn 18.0
2013-09-24 16:38:23 [73705] [INFO] Listening at: http://127.0.0.1:8000 (73705)
2013-09-24 16:38:23 [73705] [INFO] Using worker: sync
2013-09-24 16:38:23 [73708] [INFO] Booting worker with pid: 73708
2013-09-24 16:38:23 [73708] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/Users/jacob/.virtualenvs/gizmag/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
@jacobh
jacobh / gist:6102063
Created July 29, 2013 03:53
pilkit error
======================================================================
ERROR: test_hero_images_not_regenerated_when_crop_doesnt_change (fileupload.tests.test_models.FileuploadImageModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jacob/Documents/Projects/gizmag/fileupload/tests/test_models.py", line 216, in test_hero_images_not_regenerated_when_crop_doesnt_change
self.image.save()
File "/Users/jacob/Documents/Projects/gizmag/fileupload/models.py", line 166, in save
super(Image, self).save(*args, **kwargs)
File "/Users/jacob/Documents/Projects/gizmag/fileupload/models.py", line 51, in save
super(BaseMedia, self).save(*args, **kwargs)

Film For Sale

35mm

  • 10x Portra 160
  • 13x Portra 400
  • 4x Ektar (100)
  • 4x Superia 800

120

  • 11x Portra 400
@jacobh
jacobh / fabfile.py
Created May 3, 2013 07:33
my base fabfile
from __future__ import with_statement
from fabric.api import *
from fabric.contrib import files
env.roledefs = {
'prod': ['[email protected]'],
'staging': ['[email protected]'],
}
CODE_DIR = '/home/ExampleProject'
@jacobh
jacobh / gist:4160002
Created November 28, 2012 08:59
little wrapper over moment.js to turn it into a jquery plugin for relative times.
$.fn.relativize = (format='MMM D, YYYY at hh:mma') ->
for date in this
$date = $ date
if $date.attr 'unix_timestamp'
this_moment = moment.unix $date.attr 'unix_timestamp'
else
this_moment = moment $date.text(), FORMAT
$date.attr 'unix_timestamp', this_moment.unix()
@jacobh
jacobh / gist:4147072
Created November 26, 2012 07:46
jQuery validator plugin modification to allow for multiple inputs with the same name, ported to CS
$.validator::checkForm = ->
@prepareForm()
elements = (@currentElements = @elements())
for element in elements
$elem = $ "[name='#{element.name}']:not([disabled])"
if $elem.length > 1
for sub_element in $elem
@check sub_element
else
$.fn.toggle_input = (options) ->
# used for our 3-way toggles such as sentiment and disclosure
defaults =
input: 'input'
toggles: '.toggle'
active_class: 'active'
can_deselect: true
get_value: ->
@text().trim().toLowerCase().replace ' ', ''
initialize: ->
@jacobh
jacobh / gist:3673128
Created September 8, 2012 09:55
movies I've seen
  • Little Miss Sunshine
  • Batoru rowaiaru
  • The Godfather: Part II
  • In Bruges
  • Moonrise Kingdom
  • The Thing
  • Carrie
  • Chinatown
  • The Cabin in the Woods
  • (500) Days of Summer
from base64 import b64encode
from hashlib import sha256
from random import random
def random_uppercase_string():
raw = b64encode( sha256( str(random() ) ).digest() ).upper()
string = ''
for letter in raw:
if letter.isalpha():