Skip to content

Instantly share code, notes, and snippets.

View RubenVerborgh's full-sized avatar

Ruben Verborgh RubenVerborgh

View GitHub Profile
@RubenVerborgh
RubenVerborgh / iri-resolution.jsonld
Last active June 29, 2016 12:51
Turtle IRI resolution compliance test
[
{
"@context": {"@base": "http://a/bb/ccc/d;p?q", "urn:ex:p": {"@type": "@id"}},
"@graph": [
{"@id": "urn:ex:s001", "urn:ex:p": "g:h"},
{"@id": "urn:ex:s002", "urn:ex:p": "g"},
{"@id": "urn:ex:s003", "urn:ex:p": "./g"},
{"@id": "urn:ex:s004", "urn:ex:p": "g/"},
{"@id": "urn:ex:s005", "urn:ex:p": "/g"},
{"@id": "urn:ex:s006", "urn:ex:p": "//g"},
# curl -H "Accept: text/turtle" http://dbpedia.org/sparql
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ns1: <http://dbpedia.org/> .
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
ns1:sparql rdf:type sd:Service ;
sd:endpoint ns1:sparql ;
sd:feature sd:DereferencesURIs ,
sd:UnionDefaultGraph .
@prefix ns3: <http://www.w3.org/ns/formats/> .
ns1:sparql sd:resultFormat ns3:RDFa ,
Verifying that +rubenverborgh is my blockchain ID. https://onename.com/rubenverborgh
@RubenVerborgh
RubenVerborgh / sparqljs-browser.js
Created October 27, 2015 16:18
SPARQL.js 1.1.3 browser version
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.sparqljs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
(function (process){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to
@RubenVerborgh
RubenVerborgh / fragment.json
Last active October 29, 2015 10:39
Triple Pattern Fragments after paging property changes
{
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"owl": "http://www.w3.org/2002/07/owl#",
"skos": "http://www.w3.org/2004/02/skos/core#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"dc": "http://purl.org/dc/terms/",
"dcterms": "http://purl.org/dc/terms/",
"dc11": "http://purl.org/dc/elements/1.1/",

Open-source webslides die iedereen kan delen en aanpassen

Gedaan met lelijke, verwarrende en gesloten PowerPoint-slides. Ik stel voor om lesmateriaal zoals slides open-source te maken en ze in een online samenwerkingsplatform te plaatsen. Dan kunnen studenten comments posten, vragen stellen, en aanpassingen voorstellen. De beste lesgevers leren immers van hun studenten, dus waarom passen we dit principe ook niet toe op slides, hét meestgebruikte lesmateriaal?

Ik stel voor om slides in HTML te maken, de manier waarop ook websites in elkaar zitten. De voordelen van HTML zijn:

  • Slides zijn leesbaar op ieder toestel – ook mobiel.
  • Aangezien HTML focust op de structuur in plaats van op de opmaak, krijg je eenvoudigere slides die er minder verwarrend uitzien.
  • Voeg met gemak YouTube-filmpje, tweets uit Twitter, interactieve webpagina's toe aan slides. Alles wat op het Web staat, kan je gebruiken!
  • Je kan slides bewerken in je favoriete programma.
@RubenVerborgh
RubenVerborgh / parallel.js
Created April 1, 2016 16:24
Connection rate test
const http = require('http');
const baseUrl = 'http://en.wikipedia.org/wiki/', max = 100;
var index = 1;
(function fetchNext() {
if (index < max) {
var url = baseUrl + index++;
console.log(`fetching ${url}`);
request = http.request(url);
@RubenVerborgh
RubenVerborgh / eratosthenes.js
Created July 3, 2016 22:40
Sieve of Eratosthenes with AsyncIterator
var AsyncIterator = require('asynciterator'),
TransformIterator = AsyncIterator.TransformIterator;
function EratosthenesIterator(base) {
TransformIterator.call(this);
base = base || AsyncIterator.range(2);
base.once('data', prime => {
this._push(prime);
this.source = new EratosthenesIterator(base.filter(n => n % prime));
});
#!/bin/bash
$1 $2 || echo -e "$2\terror"