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
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/jmoiron/sqlx" | |
_ "github.com/lib/pq" //import pq | |
) |
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 ijson | |
from couchdbkit import (Document, Server, StringProperty, DictProperty) | |
class Route(Document): | |
id = StringProperty() | |
geometry = DictProperty() | |
properties = DictProperty() | |
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
function hexToRgb(hex) { | |
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
return result ? { | |
r: parseInt(result[1], 16), | |
g: parseInt(result[2], 16), | |
b: parseInt(result[3], 16) | |
} : null; | |
} | |
function contrastColor(color) { |
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
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var AnimatableComponent = React.createClass({ | |
propTypes: { | |
tag: React.PropTypes.component.isRequired, |
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
/** @jsx React.DOM */ | |
'use strict'; | |
var React = require('react'); | |
var ContentEditableLabel = React.createClass({ | |
propTypes: { | |
tag: React.PropTypes.func, |
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 base64 | |
import binascii | |
from Crypto.Cipher import AES | |
from django.template import Library | |
from django.utils.safestring import mark_safe | |
from django.conf import settings | |
register = Library() |
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
#optionally create two buckets and serve from root, redirecting www | |
s3cmd mb --bucket-location=EU s3://example.com | |
s3cmd mb --bucket-location=EU s3://www.example.com | |
s3cmd ws-create --ws-index=index.html s3://example.com | |
s3cmd ws-create s3://www.example.com | |
#configure www redirect if necessary | |
wget --mirror -p --html-extension --convert-links -e robots=off -P . http://example.com | |
s3cmd put --recursive --exclude=".DS_Store" --acl-public example.com/ s3://example.com | |
#create hosted zones and redirect DNS |
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
MKMapRect zoomRect = MKMapRectNull; | |
for (id <MKAnnotation> annotation in mapView.annotations) { | |
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate); | |
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); | |
if (MKMapRectIsNull(zoomRect)) { | |
zoomRect = pointRect; | |
} else { | |
zoomRect = MKMapRectUnion(zoomRect, pointRect); | |
} | |
} |