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 unhash(h): | |
s = '' | |
letters = 'acdegilmnoprstuw' | |
while h > 7: | |
v = h % 37 | |
s = letters[v] + s | |
h /= 37 | |
return s |
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 fs = require('fs'); | |
var svg = require('svg-sketch')(); | |
var size = [400, 400]; | |
var concat = require('concat-stream'); | |
var Pdf = require('svg-sketch-pdf'); | |
var controls = require('svg-sketch-controls'); | |
controls.control.setPaperSize(size); | |
var iframe = document.createElement('iframe'); | |
iframe.setAttribute('style', 'width: 400px; height: 400px; border: solid 2px #888; border-radius: 5px; position: fixed; top: 0; left: 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
function logObject(o, indent) { | |
var keys; | |
indent = indent || ''; | |
try { | |
keys = Object.keys(o); | |
} catch (e) { | |
console.log(indent + '=' + o.toString()); | |
return; |
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
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import jsprit.core.problem.Location; |
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 request = require('simple-get'), | |
extend = require('extend'); | |
function DistanceMatrix(features, options) { | |
this.options = extend({}, { serviceUrl: 'http://router.project-osrm.org/table'}, options); | |
this._features = features.features.reduce(function(fs, f, i) { | |
if (f.geometry.type !== 'Point') { | |
throw 'Feature geometries must be Points.'; | |
} |
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 osmium = require('osmium'); | |
var bboxPolygon = require('turf-bbox-polygon'); | |
var path = process.argv[2]; | |
var reader = new osmium.BasicReader(path); | |
var handler = new osmium.Handler(); | |
var locHandler = new osmium.LocationHandler(); | |
var header = reader.header(); | |
var bound = header.bounds[0], | |
extent = [bound.left(),bound.bottom(),bound.right(),bound.top()], | |
extentPolygon = bboxPolygon(extent); |
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
public static class GravatarUrlHelper | |
{ | |
public static string GravatarUrl(this UrlHelper urlHelper, string emailAddress, int size = 38, string defaultAvatar = "identicon") | |
{ | |
var md5 = MD5.Create(); | |
var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(emailAddress.Trim().ToLowerInvariant())); | |
return string.Format("https://www.gravatar.com/avatar/{0}?s={1}&d={2}", hash, size, defaultAvatar); | |
} | |
} |
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
<html> | |
<head> | |
<title></title> | |
<style type="text/css"> | |
body { | |
background-color: black; | |
padding: 0; | |
margin: 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
var L = require('leaflet'); | |
module.exports = L.CircleMarker.extend({ | |
initialize: function(latLng, heading, options) { | |
this._heading = heading; | |
L.CircleMarker.prototype.initialize.call(this, latLng, options); | |
}, | |
setHeading: function(heading) { | |
this._heading = heading; |
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
.map { | |
width: 960px; | |
height: 480px; | |
} | |
.reveal .leaflet-container .leaflet-fade-anim .leaflet-tile, .reveal .leaflet-container .leaflet-fade-anim .leaflet-popup { | |
-webkit-transition: opacity 0.2s linear; | |
-moz-transition: opacity 0.2s linear; | |
-o-transition: opacity 0.2s linear; | |
transition: opacity 0.2s linear; |