Skip to content

Instantly share code, notes, and snippets.


Olivier Louvignes mgcrea

Block or report user

Report or block mgcrea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View App.js
import React from "react";
import useMutableReducer from "./useMutableReducer";
const reducer = (draft, action, state) => {
switch (action) {
case "increment":
case "decrement":
bellbind / binding.gyp
Last active Nov 28, 2019
[nodejs]Native module with libuv and v8::Promise on node-4
View binding.gyp
# -*- mode: python -*-
"targets": [
"include_dirs": ["<!(node -e \"require('nan')\")"],
"target_name": "TimerAndPromise",
"sources": [
"conditions": [
View gist:beb96fc0afc0715f01bb
function Bucket(capacity, level){
this.capacity = capacity;
this.level = level || 0;
Bucket.prototype.fill = function(){
this.level = this.capacity;
Bucket.prototype.discard = function(){
this.level = 0;

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
NodeList.prototype.__proto__ = Array.prototype;
branneman /
Last active Feb 23, 2020
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

albi90 / building node-webkit on armv7 hardfp
Last active Dec 16, 2019
howto build node-webkit on armv7 hardfp
View building node-webkit on armv7 hardfp
sudo apt-get install libatk1.0-0 libc6 libasound2 libcairo2 libcups2 libexpat1 libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 libgtk2.0-0 libpam0g libpango1.0-0 libpci3 libpcre3 libpixman-1-0 libpng12-0 libspeechd2 libstdc++6 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2 libxrender1 libxtst6 zlib1g apache2.2-bin bison curl elfutils fakeroot flex g++ gperf libapache2-mod-php5 libasound2-dev libbz2-dev libcairo2-dev libcups2-dev libcurl4-gnutls-dev libelf-dev libgconf2-dev libgl1-mesa-dev libglib2.0-dev libglu1-mesa-dev libgnome-keyring-dev libgtk2.0-dev libkrb5-dev libnspr4-dev libnss3-dev libpam0g-dev libpci-dev libpulse-dev libsctp-dev libspeechd-dev libsqlite3-dev libssl-dev libudev-dev libwww-perl libxslt1-dev libxss-dev libxt-dev libxtst-dev mesa-common-dev metacity patch perl php5-cgi pkg-config python python-cherrypy3 python-dev python-psutil rpm ruby subversion ttf-dejavu-core ttf-indic-fonts ttf-koc
albi90 / how to
Last active Jan 20, 2019
Compiling node-webkit on raspberry pi
View how to
cd ~
mkdir .gyp
nano .gyp/include.gypi
paste the following
'variables': {
'linux_use_gold_binary' : 0,
'linux_use_gold_flags' : 0,
'target_arch': 'arm',
'disable_nacl': 1, # NaCL does not build for ARM.
PascalPrecht /
Last active Oct 31, 2018
Proposals on how to structure 'standalone' modules in angular. Please read it and leave your opinions for a better angularjs world!

Angular module structure (proposal)

Everyone who's reading this, please leave your opinion/ideas/proposals as a comment for a better world!


Most of you guys read Josh' proposals to make components more reusable, I think. Now, reading through this proposals definitely gives a feeling that this is the right way. Anyways, If you haven't read it yet, you should.

So Josh shows us, how angular apps can be structured in a better and more reusable way. Reusability is a very important thing when it comes to software development. Actually the whole angularjs library follows a philosophy of reusability. Which is why you able to make things like:

adammw /
Last active Mar 5, 2016
Node.js for Raspberry Pi Packaging Script
## Node.js for Raspberry Pi Packaging Script
## =========================================
## Execute this script from within node.js git repo
## Use like this:
## ~/node/$ VERSION=v0.10.0 ./
if [ -z $VERSION ]; then
echo "set the VERSION first"
exit 1
You can’t perform that action at this time.