Skip to content

Instantly share code, notes, and snippets.

View gionkunz's full-sized avatar
☄️
Currently riding a comet...

Gion Kunz gionkunz

☄️
Currently riding a comet...
View GitHub Profile
@gionkunz
gionkunz / http-proxy.ts
Created April 26, 2022 12:06
Angular Devkit like HTTP Proxy for Nx @nrwl/web:file-server
import * as express from 'express';
import { join } from 'path';
import { getProxyConfig } from './webpack-dev-server-proxy-conf';
function error(message: string): never {
throw new Error(message);
}
const proxyConfigPath = process.argv[2] || error('Please specify proxy config path as argument.');
@gionkunz
gionkunz / index.js
Created August 29, 2014 19:14
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@gionkunz
gionkunz / flatten.js
Last active August 29, 2015 14:05
JSON generator with circular reference censoring
function flatten(s, stack) {
if(s === undefined || s === null || (typeof s === 'number' && isNaN(s))) {
return 'null';
} else if(s instanceof Date) {
return flatten(s.toJSON(), stack);
} else if(typeof s === 'object') {
stack = stack ? {obj: s, parent: stack} : {obj: s};
if((function cyclic(obj, stack, found) {
return found ||
@gionkunz
gionkunz / index.js
Created August 10, 2014 20:55
requirebin sketch
// example using the chartist module
var Chartist = require('chartist');
var welcomeText = document.createTextNode('Chartist version ' + Chartist.version);
var container = document.createElement('div');
container.className = 'ct-chart ct-golden-section';
var styleSheet = document.createElement('link');
styleSheet.rel = 'stylesheet';