Skip to content

Instantly share code, notes, and snippets.

View BenoitZugmeyer's full-sized avatar

Benoît BenoitZugmeyer

View GitHub Profile
@BenoitZugmeyer
BenoitZugmeyer / README.md
Last active March 7, 2016 13:04
Prints the size of each modules included in a webpack bundle

Prints the size of each modules included in a webpack bundle. Add pathinfo: true, in the output property of your webpack configuration, then run node webpack-packages-size.js path_to_the_bundle.js.

@BenoitZugmeyer
BenoitZugmeyer / It.js
Created February 23, 2016 18:59
Iterator utils
var It = (function () {
var STOP = {};
function Iterator(next) {
this._next = next;
this._item = {};
this._index = -1;
}
Iterator.prototype = {
#!/bin/python
import usb
import subprocess
import time
import json
# Put:
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7403", GROUP="users",
# MODE="0666"
function dd(chunks) {
const variables = [].slice.call(arguments, 1);
let formated = "";
for (let i = 0; i < chunks.length; i += 1) {
formated += chunks[i]
if (i < chunks.length - 1) {
formated += variables[i];
}
@BenoitZugmeyer
BenoitZugmeyer / nodelist_array.js
Created December 17, 2014 16:01
NodeList Array
Object.getOwnPropertyNames(Array.prototype).forEach(function (name) {
if (!(name in NodeList.prototype))
Object.defineProperty(NodeList.prototype, name, Object.getOwnPropertyDescriptor(Array.prototype, name));
});
/* ... */
/* Profit! */
document.querySelectorAll('div').slice(3, 10);
document.body.childNodes.reduce(function (total, el) { return total + el.offsetHeight; }, 0);
@BenoitZugmeyer
BenoitZugmeyer / LICENSE.txt
Created June 23, 2011 22:32 — forked from 140bytes/LICENSE.txt
Array.prototype.reduce
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Benoît Zugmeyer <alk at graou dot fr>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE