Skip to content

Instantly share code, notes, and snippets.

View stuross's full-sized avatar

Stuart Ross stuross

  • CNN
  • San Francisco, Ca
View GitHub Profile
class Content(ContentBase):
headline = models.CharField((u'Homepage headline'), max_length=255, blank=True, null=True)
placement_category = models.ForeignKey(Category, blank=True, null=True)
published_objects = PublishedManager()
class Meta:
verbose_name_plural = "Content"
ordering = ['-pub_date']
@stuross
stuross / gist:1296727
Created October 18, 2011 21:07
article migrations
Traceback (most recent call last):
File "/home/stuart/armstrong/dev/bin/armstrong", line 8, in <module>
load_entry_point('armstrong.cli==1.0.1', 'console_scripts', 'armstrong')()
File "/home/stuart/armstrong/dev/lib/python2.6/site-packages/armstrong/cli/main.py", line 91, in main
func(argv=argv, **kwargs)
File "/home/stuart/armstrong/dev/lib/python2.6/site-packages/armstrong/cli/main.py", line 113, in call_django
execute_manager(settings, argv=new_argv)
File "/home/stuart/armstrong/dev/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/home/stuart/armstrong/dev/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
@stuross
stuross / gist:1584791
Created January 9, 2012 20:33
change to generickey.js
valueMatches : function(facet, searchTerm, callback) {
if('results' in facets.raw[facet]){
callback(facets.raw[facet].results);
} else{
var app_label = facets.raw[facet].app_label,
model = facet;
// TODO: don't pound the server
$.getJSON("/admin/" + app_label + "/" + model + "/search/", {q: searchTerm}, function(data) {
facets.raw[facet].results = data.results;
@stuross
stuross / gist:1636498
Created January 18, 2012 23:26
hack to fill gaps in masonry
/**
* jQuery Masonry v2.1.0
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
@stuross
stuross / gist:1649731
Created January 20, 2012 21:35
hack to fill gaps in masonry
/**
* jQuery Masonry v2.1.01
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
@stuross
stuross / gist:3001276
Created June 27, 2012 03:55
django ssl middleware
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
SSL = 'SSL'
class SSLRedirect(object):
"""SSL Middleware for views
Example usage:
`url(r'^my-secure-view/$', 'secure_view', {'SSL' : True}, name='my_secure_view'),`
"""
● deis-builder.service - deis-builder
Loaded: loaded (/run/fleet/units/deis-builder.service; linked-runtime)
Active: failed (Result: exit-code) since Tue 2014-08-05 18:37:54 UTC; 44s ago
Process: 14142 ExecStopPost=/usr/bin/docker stop deis-builder (code=exited, status=1/FAILURE)
Process: 28335 ExecStart=/bin/sh -c IMAGE=`/run/deis/bin/get_image /deis/builder` && docker run --name deis-builder --rm -p 2223:22 -e HTTP_PROXY=$HTTP_PROXY -e http_proxy=$http_proxy -e HTTPS_PROXY=$HTTPS_PROXY -e https_proxy=$https_proxy -e ALL_PROXY=$ALL_PROXY -e all_proxy=$all_proxy -e NO_PROXY=$NO_PROXY -e no_proxy=$no_proxy -e PUBLISH=22 -e HOST=$COREOS_PRIVATE_IPV4 -e PORT=2223 --volumes-from deis-builder-data --privileged $IMAGE (code=exited, status=4)
Process: 28325 ExecStartPre=/bin/sh -c docker inspect deis-builder >/dev/null 2>&1 && docker rm -f deis-builder || true (code=exited, status=0/SUCCESS)
Process: 28300 ExecStartPre=/bin/sh -c IMAGE=`/run/deis/bin/get_image /deis/builder`; docker history $IMAGE >/de
[2014-08-05 13:40:16,444: WARNING/Worker-1] Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
File "/app/api/models.py", line 47, in _inner
func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_fsm/__init__.py", line 267, in _change_state
return fsm_meta.field.change_state(instance, func, *args, **kwargs)
lambda-wayfarer_v12.admin.1-log.service launched c17b48a9.../10.0.0.212 launched c17b48a9.../10.0.0.212 inactive
lambda-wayfarer_v12.admin.1.service launched c17b48a9.../10.0.0.212 launched c17b48a9.../10.0.0.212 inactive
lambda-wayfarer_v12.web.1-announce.service launched c17b48a9.../10.0.0.212 launched c17b48a9.../10.0.0.212 active
lambda-wayfarer_v12.web.1-log.service launched c17b48a9.../10.0.0.212 launched c17b48a9.../10.0.0.212 active
lambda-wayfarer_v12.web.1.service launched c17b48a9.../10.0.0.212 launched c17b48a9.../10.0.0.212 active
lambda-wayfarer_v18.web.1-announce.service launched 4be9f41d.../10.0.0.213 launched 4be9f41d.../10.0.0.213 active
lambda-wayfarer_v18.web.1-log.service launched 4be9f41d.../10.0.0.213 launched 4be9f41d.../10.0.0.213 active
lambda-wayfarer_v18.web.1.service launched 4be9f41d.../10.0.0.213 launched 4be9f41d.../10.0.0.213 active
lambda-wayfarer_v18.web.2-announce.service launched 4be9f41d.../10.0.0.213 launched 4be9f41d.../10.0.0.213 active
lambda-wayfarer_v18.web.2-
stuart@Stuart-Ubuntu:~/.go/src/demoapp$ git push deis master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 831 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
-----> Go app detected
-----> Using go1.2.1
-----> Running: godep go install -tags heroku ./...
-----> Discovering process types