Skip to content

Instantly share code, notes, and snippets.

@graste
graste / .block
Created March 10, 2019 08:14 — forked from mbostock/.block
Point-Along-Path Interpolation
license: gpl-3.0
@graste
graste / .block
Created March 10, 2019 08:14 — forked from mbostock/.block
Multi-Series Line Chart
license: gpl-3.0
redirect: https://beta.observablehq.com/@mbostock/d3-multi-line-chart
@graste
graste / .block
Created March 10, 2019 08:12 — forked from mbostock/.block
Grouped Bar Chart
license: gpl-3.0
redirect: https://observablehq.com/@d3/grouped-bar-chart
@graste
graste / get_editble_thing.rq
Created March 7, 2019 16:28 — forked from knudmoeller/get_editble_thing.rq
Wikidata Query to find edible products of plants
SELECT ?ediblething ?ediblethingLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
wd:Q158657 wdt:P171+ ?parent_taxon . # Q158657 is "Malus pumila", the tree we want to find fruit for
?ediblething
wdt:P1582 ?parent_taxon ;
wdt:P279 ?superthing .
?superthing wdt:P361 wd:Q21925565 .
}
LIMIT 100
function Mutilator(data, name, context) {
this.n = name || `mutilation-${+new Date()}`;
this.d = data;
this.c = context || window;
this.isArr = function(p) {
return this.d[p].constructor == Array;
};
this.dispatch = function(p, v, t) {
this.c.dispatchEvent(
new CustomEvent(this.n, {
@graste
graste / index.js
Created July 25, 2018 09:26 — forked from iainvdw/index.js
Transmuter.js - simple state container store, fires events when property changes
import { Transmuter, listen } from './transmuter.js';
// Set up intial state
const initialState = {
name: 'lala',
isIt: true,
count: 123,
};
// Setup store
@graste
graste / disqus-to-json.php
Created July 16, 2018 16:35 — forked from evert/disqus-to-json.php
Convert Disqus export to a JSON file
<?php
$xml = simplexml_load_file('php://stdin');
$threads = [];
$posts = [];
$userMap = [
'evertp' => [
'url' => 'https://evertpot.com',
@graste
graste / graph paper.tex
Created June 20, 2018 17:32 — forked from mcnees/graph paper.tex
Make your own quadrille, graph, hex, etc paper! Uses the pgf/TikZ package for LaTeX, which should be part of any modern TeX installation.
%%-----------------------------------------------------------------------
%% Make your own quadrille, graph, hex, etc paper!
%% Uses the pgf/TikZ package for LaTeX, which should be part of
%% any modern TeX installation.
%% Email: mcnees@gmail.com
%% Twitter: @mcnees
%%-----------------------------------------------------------------------
\documentclass[11pt]{article}
@graste
graste / rollyourown.php
Created May 31, 2018 11:37 — forked from mathiasverraes/rollyourown.php
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.