Skip to content

Instantly share code, notes, and snippets.

const Element = require('ltx/lib/Element');
const Parser = require('ltx/lib/parsers/ltx');
let parser = new Parser();
let stack = [];
parser.on('startElement', (name, attrs) => {
stack.push(new Element(name, attrs));
});
@mderijcke
mderijcke / notify-newbies.js
Last active August 17, 2018 14:31
Discord newbies annoying notify bot
// Code released under Unlicense (https://unlicense.org/)
const Promise = require('bluebird');
const Discord = require('discord.js');
const fs = Promise.promisifyAll(require('fs'));
let client = new Discord.Client();
client.on('ready', async () => {
@mderijcke
mderijcke / gulpfile.js
Created April 20, 2016 12:37
Gulp Babel
const babel = require("gulp-babel")
const cache = require("gulp-cached")
const gulp = require("gulp")
const plumber = require("gulp-plumber")
gulp.task("compile", () =>
gulp.src("src/**/*.js")
.pipe(plumber())
.pipe(cache("babel"))
.pipe(babel())
@mderijcke
mderijcke / stuff5.js
Last active August 29, 2015 14:12
ES6 stuff transpiled
"use strict";
function http_get(url, _ref, userAgent) {
if (userAgent === undefined) userAgent = "Kitchen sink 2.0";
var sayHi = _ref.sayHi;
var v = _ref.verbose;
if (sayHi) {
console.log("HI!");
}
@mderijcke
mderijcke / stuff.js
Last active August 29, 2015 14:12
ES6 stuff
function http_get(url, { sayHi, verbose: v }, userAgent = "Kitchen sink 2.0") {
if (sayHi) {
console.log("HI!");
}
if (v) {
console.log("Sending request");
}
return require('http').get({
@mderijcke
mderijcke / gist:dd12f840836911dc7434
Created January 1, 2015 21:34
Why Android is terrible
- It used Java (Dalvik VM) for super low resource devices + violated many Oracle
patents
- There was no trust in the user at all, customizations were fairly limited
- Instead of complying with the Linux kernel standards and sending patches they
forked it and used a completely different standard lib (bionic)
- It reinvented many technologies like X11 (surfaceflinger, pixelflinger, etc)
- It used the Linux kernel but broke hardware compatibility with Linux kernels
- Dubbed as open source, but still had locked down bootloaders and hardware
firmware
- Versioning was terrible; many many devices are stuck on ancient, abandoned
@mderijcke
mderijcke / art2polyarea.py
Created September 24, 2014 15:05
Part of io_vector SVG import script for Blender
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the