Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️

Pierre Bertet bpierre

✌️
View GitHub Profile
@mattdesl
mattdesl / animated-grid.js
Created Jul 27, 2018
animated grid lines
View animated-grid.js
const canvasSketch = require('canvas-sketch');
const { lerp } = require('./util/math');
const settings = {
animate: true,
duration: 3,
dimensions: [ 640, 640 ],
scaleToView: true,
playbackRate: 'throttle',
fps: 24
@taktoa
taktoa / keybase.nix
Created Nov 22, 2017
Getting the Keybase GUI to work on NixOS
View keybase.nix
# Add this file to your /etc/nixos/configuration.nix `imports = [ ... ];` attribute.
#
# After running `nixos-rebuild switch`, `systemctl --user start keybase-gui.service`
# can be used to start the Keybase GUI.
#
# Not sure if it's just my tiling window manager, but there is a bit of wonkiness
# with the tray icon. Other than that it works perfectly (as of 2017/11/22).
{ pkgs, ... }:
@ebidel
ebidel / feature_detect_es_modules.js
Last active Feb 3, 2021
Feature detect ES modules: both static import and dynamic import()
View feature_detect_es_modules.js
<!--
Complete feature detection for ES modules. Covers:
1. Static import: import * from './foo.js';
2. Dynamic import(): import('./foo.js').then(module => {...});
Demo: http://jsbin.com/tilisaledu/1/edit?html,output
Thanks to @_gsathya, @kevincennis, @rauschma, @malyw for the help.
-->
View upgradeable.sol
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active Apr 16, 2021
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2020.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@Avaq
Avaq / combinators.js
Last active Apr 12, 2021
Common combinators in JavaScript
View combinators.js
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@mahemoff
mahemoff / semver.sh
Created Dec 17, 2015
Aliases to support semantically-versioned git tags
View semver.sh
# First install https://github.com/flazz/semver
# With this script, you can run "vminor add more cowbell" or just "vminor"
function vbump() {
level=$1
semver inc $level
shift
git tag -a $(semver tag) -m "${*:-bump}"
git tag -n9 | grep `git describe` # show annotated
}
@jlongster
jlongster / immutable-libraries.md
Last active Mar 24, 2021
List of immutable libraries
View immutable-libraries.md

A lot of people mentioned other immutable JS libraries after reading my post. I thought it would be good to make a list of available ones.

There are two types of immutable libraries: simple helpers for copying JavaScript objects, and actual persistent data structure implementations. My post generally analyzed the tradeoffs between both kinds of libraries and everything applies to the below libraries in either category.

Libraries are sorted by github popularity.

Persistent Data Structures w/structural sharing

@kpuputti
kpuputti / fold.js
Last active Oct 29, 2020
Functional acrobatics using folds in JavaScript.
View fold.js
/*eslint-env es6 */
// Inspired by the paper "A tutorial on the universality and
// expressiveness of fold" by Graham Hutton (available at
// http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic
// list handling functions in JavaScript in terms of `fold`.
// Personally I had an enlightnening moment when I realised the
// beautiful interplay of cons lists and foldr during the FP101x
// Haskell course. JavaScript's syntax doesn't make this very apparent