Skip to content

Instantly share code, notes, and snippets.

Drinking coffee

Jason Goldstein whatisjasongoldstein

View GitHub Profile
whatisjasongoldstein / 0_reuse_code.js
Created Jan 14, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

whatisjasongoldstein / gist:5525444
Created May 6, 2013
Assignment tag, really simple
View gist:5525444
{% get_blocks_for campaign 'area' as foo %}
def get_blocks_for_campaign(campaign, area):
return campaign.whatever_dict.get(area)
View gist:5117530
var ImgWidget = function(){
// Keeps "currently" up to date next to the image widget
var _truncate_temp_file = function(filename){
value = filename.split('/');
value = value[0].split('\\'); // appease windows
value = value[value.length - 1];
View gist:4485980
# {}.get()'s second argument only kicks in if there's no key.
# None, '', or falsy values are perfectly okay.
# If you actually want ot fall back to a default, use or.
In [1]: data = {'red':None}
In [2]: data.get('red','backup')
In [3]: data.get('red') or 'backup'
Out[3]: 'backup'
View shoebox.js
if (typeof(log) === 'undefined') {
function log(s) {
whatisjasongoldstein / gist:4448411
Created Jan 3, 2013
Static servering, pre-1.4 style
View gist:4448411
import sys
if 'runserver' in sys.argv:
from django.conf import settings
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': "%s/static/" % settings.PROJECT_ROOT, 'show_indexes': True}),
View Sublime Packages.txt
HTML (Django)
Indent XML
Pretty JSON
whatisjasongoldstein / gist:4331779
Created Dec 18, 2012
Bug, docs issue, or my being stupid? (Translations behave differently when imported as _)
View gist:4331779
In [1]: from django.utils.translation import ugettext as _
In [2]: [_('red'),_('blue')]
Out[2]: [u'red', u'blue']
In [3]: [_('red'),_('blue')]
TypeError Traceback (most recent call last)
/Users/jg026715/.virtualenvs/iqh/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>()
----> 1 [_('red'),_('blue')]
You can’t perform that action at this time.