This file contains 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 factorial(x): | |
result = 1 | |
for i in xrange(1, x + 1): | |
result *= i | |
return result | |
###################################################################### | |
def _if(test): | |
return lambda alternative: \ |
This file contains 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
import json | |
from shapely.geometry.base import BaseGeometry | |
from shapely.geometry import shape, mapping | |
class ShapelyEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, BaseGeometry): | |
return mapping(obj) | |
return json.JSONEncoder.default(self, obj) |
This file contains 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
import timeit | |
setup = """ | |
import random, operator | |
class Test(): | |
def __init__(self, t): | |
self.test = t | |
l = [Test(str(i)) for i in range(1000)] |
This file contains 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
# Adjust device pixel ratio | |
setMaximumPixelRatio = (p_maximumRatio=1) -> | |
canvas = document.createElement('canvas') | |
context = canvas.getContext('2d') | |
devicePixelRatio = window.devicePixelRatio || 1 | |
backingStoreRatio = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1 | |
pixelRatio = devicePixelRatio / backingStoreRatio | |
for className in ["HitCanvas", "SceneCanvas", "Canvas"] | |
Kinetic[className].prototype.init = ((p_method) -> (p_config={}) -> |
This file contains 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
parseInt(getComputedStyle($('#hours'), ':after').top)/-76*60*60 + | |
parseInt(getComputedStyle($('#seconds'), ':after').top)/-76 + | |
parseInt(getComputedStyle($('#minutes'), ':after').top)/-76*60 + | |
parseInt(getComputedStyle($('#centiseconds'), ':after').top)/-76/100 |
This file contains 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
# psql: | |
# CREATE DATABASE mydatabase; | |
# \connect mydatabase | |
# CREATE EXTENSION postgis; | |
# GEOS from buildpack | |
try: | |
GEOS_LIBRARY_PATH = os.path.join(os.environ['GEOS_LIBRARY_PATH'], 'libgeos_c.so') | |
GDAL_LIBRARY_PATH = os.path.join(os.environ['GDAL_LIBRARY_PATH'], 'libgdal.so') | |
except: |
This file contains 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
https://github.com/cyberdelia/heroku-geo-buildpack.git#1.1 | |
https://github.com/heroku/heroku-buildpack-python.git#v29 |
This file contains 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
database: | |
post: | |
- psql -c "CREATE EXTENSION postgis;" -d circle_test |
This file contains 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
@mixin icon($name, $code) | |
.icon-#{$name}:before | |
content: "#{$code}" | |
// Usage: | |
+icon(heart, \e600) | |
// Compiles to: | |
.icon-heart:before { | |
content: "\e600"; |
This file contains 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
<div></div> |
OlderNewer