Skip to content

Instantly share code, notes, and snippets.

View TobyEalden's full-sized avatar

Toby Ealden TobyEalden

View GitHub Profile
@TobyEalden
TobyEalden / index.js
Last active October 4, 2016 13:46 — forked from iendjinn/index.js
var topojson = require("topojson");
//var TDXApi = require("nqm-api-tdx");
var fs = require("fs");
function propertyTransform(feature) {
return feature.properties;
}
function databot(input, output, context) {
output.progress(0);
@TobyEalden
TobyEalden / codetest.js
Last active January 31, 2017 14:07 — forked from iendjinn/codetest.js
let total = 0;
for (let i = 0; i < 100; i++) {
asynchronousFunction(i, (result) => {
total = total + result;
});
}
storeTotal(total);
/*
what is wrong with this code?
@TobyEalden
TobyEalden / Bluebird.js
Last active February 17, 2017 12:44 — forked from iendjinn/Bluebird.js
// estimator.js
module.exports = (function() {
var getData = function(id, cb) {
return api.getDataAsync(id, this.state.filter);
}
function estimator(initial) {
this.state = initial;
@TobyEalden
TobyEalden / overkill?.js
Last active May 2, 2017 09:34 — forked from iendjinn/overkill?.js
this is overkill :)
function blob(xIn, yIn) {
const x = xIn;
const y = yIn;
this.setY = (yIn) => {
y = y;
};
this.getY = () => {
return y;
};
const databot = function(input, output, context) {
const api = context.tdxApi;
let x = 0;
const readStream = api.getNDDatasetData(
"HygXQFrwx-", // This contains nearly 6 million documents
null,
null,
{limit: 0}
);
const writeStream = split(JSON.parse, null, {trailing: true});
module.exports = (function() {
"use strict";
const Promise = require("bluebird");
function databot(input, output, context) {
const tdxApi = context.tdxApi;
const mappingId = input.mappingId;
// filter boundary dataset with a list of all ccgs
const filter = {
mappingType: "ons-mapping",
parentType: "CCG15CD",