Skip to content

Instantly share code, notes, and snippets.

View bvdeenen's full-sized avatar
🏠
Working from home

Bart van Deenen bvdeenen

🏠
Working from home
View GitHub Profile
sysPath=require('path');
files=['a','b','c'];
parent= "yo";
myjoin = function(a,b){return sysPath.join(a,b);}
console.log(files.map( myjoin.bind(null, parent) )); // works fine
console.log(files.map( sysPath.join.bind(null, parent) )); // throws exception
@bvdeenen
bvdeenen / dependency-chain.cypher
Last active June 12, 2017 13:20
dependency chain in Neo4J Cypher
[source,cypher]
----
CREATE (DB1:Database {backbone: true, name:"postgres db 1"})
CREATE (Ingest1:Ingest {backbone: true, name: "ingest-1"})
CREATE (KV1:KV {name: "key-value store 1"})
CREATE (KV2:KV {name: "key-value store 2"})
CREATE (KV1)-[:requires]->(DB1)
CREATE (KV2)-[:requires]->(DB1)
CREATE (Topic1:Topic {name: "topic-1", partitions:100})
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package com.kpn.datalab.schemas.omnicrm.contact_history.v1;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class contactHistory extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"contactHistory\",\"namespace\":\"com.kpn.datalab.schemas.omnicrm.contact_history.v1\",\"fields\":[{\"name\":\"events\",\"type\":{\"type\":\"array\",\"items\":\"bytes\"}},{\"name\":\"krn\",\"type\":\"string\"}]}");
// the gist of my deserialize
private DatumReader<GenericRecord> reader;
reader = new SpecificDatumReader<>(writerSchema, readerSchema);
GenericRecord deserialize(byte[] msg) throws IOException, IllegalStateException
{
BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(msg, null);
return reader.read(null, decoder);
}
0x8C0b7c0c3b3c51c58de179326a2307D769E3ed27
0x8C0b7c0c3b3c51c58de179326a2307D769E3ed27
11026e8797350c49105a3622f14dbfe28cf6e5ec
0x8c0b7c0c3b3c51c58de179326a2307d769e3ed27
11026e8797350c49105a3622f14dbfe28cf6e5ec
11026e8797350c49105a3622f14dbfe28cf6e5ec