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
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals, absolute_import, division | |
| import os | |
| import sys | |
| # based on https://gist.github.com/magopian/7543724 | |
| # | |
| # refactored for manual control over permissions created. | |
| projectname = input("Enter project name (for settings import): ") |
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 sys, os, os.path | |
| sys.path.append('.') | |
| # Weird hack, __import__("a.b.c") returns module a unless fromlist is non-empty, then it returns module c | |
| filename = __import__(sys.argv[1], fromlist=["whatever"]).__file__ | |
| os.system('subl ' + os.path.dirname(filename)) |
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 chardet.universaldetector import UniversalDetector | |
| import os.path | |
| import sys | |
| import dbfUtils | |
| import sys | |
| from osgeo import osr | |
| from urllib import urlencode | |
| from urllib2 import urlopen | |
| import json |
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 PIL import Image, ImageCms | |
| im = Image.open(image_path) | |
| if im.mode != "RGB": | |
| im = im.convert("RGB") | |
| srgb_profile = ImageCms.createProfile("sRGB") | |
| lab_profile = ImageCms.createProfile("LAB") | |
| rgb2lab_transform = ImageCms.buildTransformFromOpenProfiles(srgb_profile, lab_profile, "RGB", "LAB") |
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 psycogreen.gevent import patch_psycopg | |
| def post_fork(server, worker): | |
| patch_psycopg() |
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
| var screenshotUrl = 'http://example.com/' | |
| var casper = require("casper").create({ | |
| viewportSize: { | |
| width: 1024, | |
| height: 768 | |
| } | |
| }); | |
| if (casper.cli.args.length < 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
| from __future__ import unicode_literals | |
| import base64 | |
| import binascii | |
| import os | |
| import re | |
| import logging | |
| log = logging.getLogger(__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
| var Complex = function(real, imag) { | |
| if (!(this instanceof Complex)) { | |
| return new Complex (real, imag); | |
| } | |
| if (typeof real === "string" && imag == null) { | |
| return Complex.parse (real); | |
| } | |
| this.real = Number(real) || 0; |
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
| // includes bindings for fetching/fetched | |
| var PaginatedCollection = Backbone.Collection.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage'); | |
| typeof(options) != 'undefined' || (options = {}); | |
| this.page = 1; | |
| typeof(this.perPage) != 'undefined' || (this.perPage = 10); | |
| }, | |
| fetch: function(options) { |
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
| /* | |
| * Takes provided URL passed as argument and make screenshots of this page with several viewport sizes. | |
| * These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed | |
| * | |
| * Usage: | |
| * $ casperjs screenshots.js http://example.com | |
| */ | |
| var casper = require("casper").create(); |
OlderNewer