Instantly share code, notes, and snippets.

View wat-the-wat.js
// This succesfully merges the supplied object with the state object
function builder(){
let state = {};
return {
options: function (){
state = mergeFragment('opts', state, optionsFragment(...arguments));
},
product: function(){
return state;
}
View howWeTech.js
function HowWeTech(someTech){
declare(`${someTech} is awesome - let's use it!!!`);
warn(`but it's possible to abuse ${someTech}`);
abuse(someTech);
blame(someTech, `it was able to be abused!!`);
let ourTech = createLesser(someTech);
try {
use(ourTech);
} catch (e) {
declare(`hey, have you seen ${someNewTech}??`);
View CsvShredder.java
package com.howarddierking.demo;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.io.fs.ResourceId;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.io.FilenameUtils;
View gist:7f7d0ffd9e0a38933aad883336a7cbac
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <https://schema.org/> .
@prefix ex: <http://foo.com/1.0/> .
ex:howard_dierking schema:givenName "Howard" .
ex:triple123 rdf:type rdf:Statement .
ex:triple123 rdf:subject ex:howard_dierking .
ex:triple123 rdf:predicate schema:givenName .
ex:triple123 rdf:object "Howard" .
ex:triple123 schema:dateModified "2016-12-07" .
View dumpContainer.sh
azure storage blob list -c "<Connection String>" --container "<Blob Container>" | \
awk '{print $2}' | head -n -1 | tail -n +5 | xargs -P <Desired Parallelism> -I {} \
azure storage blob download -c "<Connection String>" --container "<Blob Container>" -b {} -d .
View bunyan.js
var bunyan = require('bunyan').createLogger({
name: "foo",
streams: [
{
stream: process.stdout,
level: "trace"
}
]
});
View gist:70800c66e63fa43e96ad
// FROM THE SHELL
{
"result" : "organizations_reduced_ecosystems",
"timeMillis" : 20827,
"counts" : {
"input" : 198751,
"emit" : 198740,
"reduce" : 26380,
"output" : 162220
View failingMapReduce.js
var mapByOrgID = function(){
var orgID = this.OrgID;
if(orgID)
emit(orgID, { ecosystem: this.ecosystem });
};
var reduceEcosystems = function(key, values){
var ret = {
orgID: key,
ecosystems: []
View gist:11158160
var dbClient;
var ensureDbClient = function(callback){
if(dbClient){
console.info('ensureDbClient: returning existing client');
return callback(null, dbClient);
} else {
console.info('ensureDbClient: returning NEW client');
MongoClient.connect(mongoConnectionString, mongoConnectionOptions, function(err, db){
if(err){
return callback(err, null);
View countPlusLimitSet.cypher
start o=node(999)
match(o)-[:serves]->(i)
with count(distinct i) as total, o
match(o)-[:serves]->(i)
return distinct total, i.Industry limit 10;