Skip to content

Instantly share code, notes, and snippets.

View VandeurenGlenn's full-sized avatar
💭
I may write messy code.

Glenn Vandeuren VandeurenGlenn

💭
I may write messy code.
View GitHub Profile
class ProgressRing extends HTMLElement {
constructor() {
super();
const stroke = this.getAttribute('stroke');
const radius = this.getAttribute('radius');
const normalizedRadius = radius - stroke * 2;
this._circumference = normalizedRadius * 2 * Math.PI;
this._root = this.attachShadow({mode: 'open'});
this._root.innerHTML = `
@VandeurenGlenn
VandeurenGlenn / gist:06247c8a06c0840c79a2fdd532475eef
Created December 16, 2019 17:23 — forked from ciaranj/gist:9056285
A *working* (on Windows) UDP Multicast client & server with Node.Js v0.10.25 (I spent a *LOT* of time getting EINVAL and I still don't quite know why :/)
For my own sanity ;) Scraped from a variety of places, including: http://stackoverflow.com/questions/14130560/nodejs-udp-multicast-how-to?utm_medium=twitter&utm_source=twitterfeed
!Server
var news = [
"Borussia Dortmund wins German championship",
"Tornado warning for the Bay Area",
"More rain for the weekend",
"Android tablets take over the world",
"iPad2 sold out",
@VandeurenGlenn
VandeurenGlenn / lines.js
Last active March 11, 2019 19:35
partyvibes
export default params => {
const store = {};
let string = '';
if (params === undefined) {
params = {count: 6, substract: 0, width: 12, height: 3, substractHeight: 0};
}
let {count, substract, width, height, substractHeight} = params;
if (count === undefined) count = 6;
if (substract === undefined) substract = 0;
if (substractHeight === undefined) substractHeight = 0;
import define from '../../node_modules/backed/src/utils/define';
import RenderMixin from '../../node_modules/custom-renderer-mixin/src/render-mixin';
import './party-slider';
import lines from './../utils/lines';
export default define(class PartyMixer extends RenderMixin(HTMLElement) {
constructor() {
super();
this.attachShadow({mode: 'open'})
this._change = this._change.bind(this)

library

There are 2 libraries to load, our shipped library and the user's one.

locations

  • user/.daw/library
  • installdir/library

paths

each lib exist out:

@VandeurenGlenn
VandeurenGlenn / daemon
Last active December 24, 2018 11:14
Getting started with ipfsd-node
import ipfsdNode from 'ipfsd-node';
(async () => {
const ipfsd = await ipfsdNode({
bootstrap: 'earth',
sharding: true,
relayHop: true,
flags: ['--enable-pubsub-experiment'],
repoPath: 'path/to/repo',
cleanup: false
@VandeurenGlenn
VandeurenGlenn / index.js
Created August 1, 2018 20:21
Buffer to ArrayBuffer
const {readFile} = require('fs');
readFile('path/to/some/file', (error, buffer) => {
const arrayBuffer = new ArrayBuffer(buffer.length)
const bufferView = new Uint8Array(arrayBuffer);
for (var i=0, length=buffer.length; i < length; i++) {
bufferView[i] = buffer[i];
}
@VandeurenGlenn
VandeurenGlenn / README.md
Created April 5, 2018 22:57
Uni Routing
@VandeurenGlenn
VandeurenGlenn / merge.js
Created December 22, 2017 22:06
Quick object merging.
/**
* @export merge
*
* @param {object} object The object to merge with
* @param {object} source The object to merge
* @return {object} merge result
*/
export const merge = (object = {}, source = {}) => {
// deep assign
for (const key of Object.keys(object)) {