Skip to content

Instantly share code, notes, and snippets.

View gerbrand's full-sized avatar

Gerbrand van Dieyen gerbrand

View GitHub Profile
@gerbrand
gerbrand / woocommerce-openapi-3.0.x.yml
Last active November 8, 2021 08:24
Woocommerce openapi spec
openapi: 3.0.0
info:
title: wc/store
description: Generated OpenAPI document of the namespace wc/store on Software-Creation.
version: '1'
servers:
- url: https://www.software-creation.nl/wp-json/wc/store
paths:
/:
get:
@gerbrand
gerbrand / UUIDToObjectId.scala
Created July 20, 2018 11:56
Converting an UUID to an MongoDB ObjectId by discarding a few insignificant bits
object UUIDToObjectId {
def uuidToObjectId(uuid: UUID): ObjectId = {
import java.util.UUID
import org.bson.types.ObjectId
val b = java.nio.ByteBuffer.allocate(12)
b.putLong(uuid.getMostSignificantBits)
b.putInt((uuid.getLeastSignificantBits >> 16).intValue)
new ObjectId(b.array())
}
@gerbrand
gerbrand / keybase.md
Created November 23, 2017 22:01
keybase.md

Keybase proof

I hereby claim:

  • I am gerbrand on github.
  • I am gerbrand (https://keybase.io/gerbrand) on keybase.
  • I have a public key ASAFbEFj_mXeUb-XJnf4gdLBWqEY_y8UkqXMHyBk8pfTWwo

To claim this, I am signing this object:

Verifying that "gerbrandvd.id" is my Blockstack ID. https://onename.com/gerbrandvd
@gerbrand
gerbrand / spreadingactivation-dutch.adoc
Last active March 22, 2016 14:20
Spreading activation in neo4j, Dutch

Spreading activation in Neo4j

Introduction

Hoe werkt ons brein? Hoe herinneren we ons iets? Hierover denken is al behoorlijk verwarrend. Een mogelijkheid antwoord uit de wetenschappelijke wereld is dat ons brein werkt als een semantisch netwerk. Op Kahn Academy, de gratis universiteit wordt een heldere uitleg gegeven door Carole Yue, gratis beschikbaar. Onze ervaringen, herinneringen zijn met elkaar verbonden, sommige sterker dan andere. Ieder feit, of het nu een abstract begrip, persoon, ding of gebeurtenis is verbonden aan een ander feit. De sterkte van die verbinding verschilt en hangt af van allerlei factoren als ervaring en emotie op moment dat de verbinding werd gelegd. Probeer maar: noem eens een vogel? Waarschijnlijk is het eerste waar je aan denkt een mus of eend. Een uitgestorven dier? Nu denk je misschien aan een dodo, mammoet of dinosaurus. Dier op de zuidpool: een pinguin? Of een ijsbeer? Onze her

@gerbrand
gerbrand / spreadingactivation.adoc
Last active April 4, 2022 10:11 — forked from jexp/graph_gist_template.adoc
Demonstration spreading activation in Neo4j

Spreading activation in Neo4j

Introduction

How does the human brain work? How do thoughts pop up in our conscience? Just thinking about the question is confusion enough. Maybe our brain works as a semantic network as explained by Carole Yue at Kahn Academy.
Try for yourself: think of a bird? You probably think a sparrow, duck. Think of an extinct animal? Now you might think of the dodo, mammoth or dinosaur. Animal living on the south pole: a penguin? Or polar bear?

Facts, ideas, memories in our brain are interconnected. They’re not structured into tables like in relational databases or hierarchical in directories on a harddrive: if I’d ask you to name all the birds you know, you won’t give me a long list immediately. A better model of human m

//Creating a Mongo collection to keep track of events
EthEvents = new Mongo.Collection('ethEvents');
EthEvents.attachSchema(new SimpleSchema({
contractAddress: {
type: String,
index: true
},
eventName: {
type: String,
index: true
@gerbrand
gerbrand / SOAPUIProjectExtractor.scala
Last active April 7, 2016 13:26
A SOAPUI-project file contained a testsuite. The testsuite consisted of (xml) requests to a certain rest-service. I wanted to extract all those request-messages to use them in my own test. Doing that by hand was a bit cumbersome and boring. I decided to write a small script for do that in Scala. Writing the script was a lot easier then doing it …
import scala.xml._
import java.io._
/**
* Small script to extract the request-xml-messages from a soapui project
*/
object SoapUIExtractor extends App {
def writeTestStep(teststep:Node) {
val requestContent = (teststep \ "config" \ "restRequest" \ "request").head.child(0).text