Skip to content

Instantly share code, notes, and snippets.

View whatisjasongoldstein's full-sized avatar

Jason Goldstein whatisjasongoldstein

View GitHub Profile
# {}.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'
var ImgWidget = function(){
// Keeps "currently" up to date next to the image widget
// HELPERS
//////////
var _truncate_temp_file = function(filename){
value = filename.split('/');
value = value[0].split('\\'); // appease windows
value = value[value.length - 1];
@whatisjasongoldstein
whatisjasongoldstein / gist:5525444
Created May 6, 2013 14:16
Assignment tag, really simple
{% get_blocks_for campaign 'area' as foo %}
@register.assignment_tag
def get_blocks_for_campaign(campaign, area):
return campaign.whatever_dict.get(area)
@whatisjasongoldstein
whatisjasongoldstein / 0_reuse_code.js
Created January 14, 2016 18:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console