Skip to content

Instantly share code, notes, and snippets.

View wavded's full-sized avatar
🐢
Turtles all the way

Marc Harter wavded

🐢
Turtles all the way
View GitHub Profile
if (!this.props.isInitialized) {
return (
<FlexRow>
<FlexColumn>
<EMap bingKey={this.props.bingKey} active={true} />
</FlexColumn>
</FlexRow>
)
}
@wavded
wavded / gen.js
Created April 23, 2014 21:55
TCO in Generators
function* fibGen (current, next) {
yield current
yield* fibGen(next, current + next)
}
for (var num of fibGen(0,1));
// function* fibGen (current, next) {
// ^
// RangeError: Maximum call stack size exceeded
@wavded
wavded / image format test results
Created January 20, 2014 20:44
Map tile format r&d, based on resolutions
JPEG / No Imagery / Fresh Cache
250000 - 196.5k
150000 - 212.8k
100000 - 1.2m
80000 - 1.2m
50000 - 1m
35000 - 831.1k
32000 - 735.1k
25000 - 772.8k
@wavded
wavded / commands.sh
Last active January 3, 2016 10:19
Misc Commands
# A makeshift SMTP server that logs all messages to the console
python -m smtpd -n -c DebuggingServer localhost:25
# Spotlight search results in terminal
mdfind
@wavded
wavded / test-single.geojson
Last active December 27, 2015 19:19
ogr2ogr.test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// works
var fs = require('fs'),
spawn = require('child_process').spawn,
out = fs.openSync('./out.log', 'a'),
err = fs.openSync('./out.log', 'a');
var child = spawn('prg', [], {
detached: true,
stdio: [ 'ignore', out, err ]
});
@wavded
wavded / setup.sh
Created July 31, 2013 15:56
Ubuntu PhantomJS Setup
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2
tar xvf phantomjs-1.9.1-linux-x86_64.tar.bz2
sudo mv phantomjs-1.9.1-linux-x86_64 /usr/local/lib/phantomjs
sudo ln -s /usr/local/lib/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
function map (arr, func) {
return Promise.resolve().then(function () {
return arr.map(function (el) { return func(el) })
}).all()
}
function mapSeries (arr, func) {
let currentPromise = Promise.resolve()
let promises = arr.map(function (el) {
return currentPromise = currentPromise.then(function () {
@wavded
wavded / series.js
Last active December 20, 2015 05:09
var fs = require('fs')
var Q = require('q')
var fs_stat = Q.denodeify(fs.stat)
var files = ['./fixtures/file1', './fixtures/file2', './fixtures/file3']
function getStatsSeries (files) {
var d = Q.defer()
var results = []
files.reduce(function (last, file) {
@wavded
wavded / promise.js
Last active May 6, 2021 13:25
Promise A+ Implementation
"use strict"
var Promise = function () {
this.state = 'pending'
this.thenables = []
}
Promise.prototype.resolve = function (value) {
if (this.state != 'pending') return
this.state = 'fulfilled'