Skip to content

Instantly share code, notes, and snippets.

View rhalff's full-sized avatar

Robbert Halff rhalff

  • Robbert Halff
  • Netherlands
View GitHub Profile
@JamieMason
JamieMason / es6-compose.md
Last active May 17, 2022 17:38
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
@rawsh
rawsh / .Xresources
Last active February 11, 2024 11:56
.Xresources theme for rofi and terminal
! *----------------------------*
! | Dotfiles - .Xresources |
! *----------------------------*
! This files contains configuration for:
! * terminal colours
! * urxvt
! * rofi
@jtbonhomme
jtbonhomme / forkStream.js
Created September 13, 2016 14:36
This gist shows how to fork a nodejs stream into 2 streams
var spawn = require('child_process').spawn;
var pass = require('stream').PassThrough;
var a = spawn('echo', ['hi user']);
var b = new pass;
var c = new pass;
a.stdout.pipe(b);
a.stdout.pipe(c);
@ebidel
ebidel / fancy-tabs-demo.html
Last active March 8, 2024 23:08
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<style>
body {
margin: 0;
}
/* Style the element from the outside */
/*
fancy-tabs {
margin-bottom: 32px;
@SiZapPaaiGwat
SiZapPaaiGwat / webpack.nginx.conf
Last active November 19, 2021 19:10
webpack-dev-server configuration in nginx on development server
upstream ws_server {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.1.2.225;
location / {
proxy_pass http://ws_server/;
@anvaka
anvaka / 00.Intro.md
Last active April 30, 2024 03:36
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@mohamed
mohamed / build-gn.sh
Last active September 23, 2022 06:25
Build Google gn build tool standalone
#!/usr/bin/env sh
set -euv
# Updated on April 2019 to reflect changes in GN
# See:
# https://github.com/ninja-build/ninja
# https://gn.googlesource.com/gn/
# We need a recent git
@davidrapin
davidrapin / jsonError.js
Last active April 18, 2024 19:16
Extract a detailed JSON parse error (with line and column) in nodejs
'use strict';
var clarinet = require('clarinet');
/**
* Extract a detailed JSON parse error
* using https://github.com/dscape/clarinet
*
* @param {string} json
* @returns {{snippet:string, message:string, line:number, column:number, position:number}} or undefined if no error
*/
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
@ericelliott
ericelliott / fp-lingo.md
Last active February 2, 2023 23:33
A Guide to Functional Programming Lingo for JavaScripters

A Guide to Functional Programming Lingo for JavaScripters

Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.

The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!

All examples using ES6 syntax. wrap (foo) => bar means:

function wrap (foo) {