This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| from flask import Flask, request, g, make_response | |
| app = Flask(__name__) | |
| ALLOWED_ORIGINS = ( | |
| 'http://jsbin.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Latest nVidia drivers | |
| ppa:ubuntu-x-swat/x-updates | |
| Legacy Python | |
| ppa:fkrull/deadsnakes | |
| Boot Repair | |
| ppa:yannubuntu/boot-repair | |
| Redis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| import re | |
| import subprocess | |
| ts_pat = re.compile("Date/Time Original\s+:\s+(.+)", re.M) | |
| gps_pat = re.compile("GPS Date/Time\s+:\s+(.+)", re.M) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| namingstyle | |
| =========== | |
| Convert to different naming styles | |
| >>> foo = 'variable_name' | |
| >>> namingstyle.to_hyphen(foo) | |
| 'variable-name' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.namevatar = (options) -> | |
| options = $.extend | |
| parentSelector: '.user' | |
| nameSelector: '.name' | |
| , options | |
| $(@).each -> | |
| $el = $(@) | |
| $name = $el | |
| .closest(options.parentSelector) | |
| .find(options.nameSelector) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:var require=function(e,r){var t=require.resolve(e,r||"/"),o=require.modules[t];if(!o)throw Error("Failed to resolve module "+e+", tried "+t);var n=o._cached?o._cached:o();return n};require.paths=[],require.modules={},require.extensions=[".js",".coffee"],require._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},require.resolve=function(){return function(e,r){function t(e){if(require.modules[e])return e;for(var r=0;require.extensions.length>r;r++){var t=require.extensions[r];if(require.modules[e+t])return e+t}}function o(e){e=e.replace(/\/+$/,"");var r=e+"/package.json";if(require.modules[r]){var o=require.modules[r](),n=o.browserify;if("object"==typeof n&&n.main){var i=t(s.resolve(e,n.main));if(i)return i}else if("string"==typeof n){var i=t(s.resolve(e,n));if(i)return i}else if(o.main){var i=t(s.resolve(e,o.main));if(i)return i}}return t(e+"/index")}function n(e,r){for(var n=i(r),s=0;n.length>s;s++){var a=n[s],u=t(a+"/"+e);if(u)return u;var l=o(a+"/"+e);if(l)return l}var u=t(e);return u?u:void 0}funct |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def join_url(*args): | |
| """Joins url paths into one url | |
| In [1]: join_url('/a/b/', '/c/d', '/e/f') | |
| Out[1]: '/a/b/c/d/e/f' | |
| """ | |
| return '/'.join( | |
| [args[0].rstrip('/')] + | |
| [p.strip('/') for p in args[1:-1]] + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://freetypography.com/ | |
| http://www.premiumpixels.com/ | |
| http://subtlepatterns.com/ | |
| http://randomc.net/ | |
| http://www.exocomics.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| web: gunicorn hello:app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def incrementer(i=1): | |
| _l = dict() | |
| def c(n=None): | |
| if n: | |
| _l.setdefault(n, 0) | |
| _l[n] += i | |
| return _l[n] | |
| else: | |
| return _l | |
| return c |