Skip to content

Instantly share code, notes, and snippets.

lakshin / multirequire.js
Last active Nov 24, 2017
Use multiple package versions in one node project
View multirequire.js
const http = require('http');
//const niv = require('npm-install-version');
const chalkv2 = require('chalk');
const multiRequire = require('./multiRequire');
const chalkv1 = multiRequire().multiRequire('chalk','1.0.0');
console.log('chalk v1';
console.log('chalk v2';
const hostname = '';
contra /
Last active Jun 10, 2021
Age of Empires II HD - For Mac OSX

AOE2HD - For Mac OSX

Estimated time: 10 minutes


PlayOnMac does not work on macOS Catalina at all - and on older versions of macOS issues have been reported with the latest version of Steam. Updating is in progress, read more here.

When the updates are released this guide will be updated. Please do not blow up my inbox by leaving comments "WHY DOESNT IT WORK".

View redux-simple-store.js
// reducer.js
let initialState = 0;
function reducer (state=initialState, action) {
return state + 1;
return state
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp = data
self.previous_hash = previous_hash

Follow the dirty money

A shady Internet business has been discovered.

The website has been made public by a whistle blower. We have enough evidence about the dirty deals they did. But to charge them we need to get hands on precise numbers about the transactions that happened on their platform.

Unfortunately no record of the transactions could be seized so far. The only hint we have is this one transaction:

jaredhowland /
Last active Feb 9, 2021
Clear Mac OS X Font Caches
adam-p / Local PR test and
Last active Jun 8, 2021
Testing a pull request, then merging locally; and avoiding TOCTOU
View Local PR test and

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37:

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
allenwb /
Last active May 26, 2021
New ES6 constructor features and semantics: Alternative 2 manual super in derived classes

New ES6 Constructor Semantics and Usage Examples

Manual super: Alternative Design where subclass constructors do not automatically call superclass constructors

This Gist presents a new design of class-based object construction in ES6 that does not require use of the two-phase @@create protocol.

One of the characteristics of this proposal is that subclass constructors must explicitly super invoke their superclass's constructor if they wish to use the base class' object allocation and initialization logic.

An alternative version of this design automatically invokes the base constructor in most situations.

subfuzion /
Last active Apr 26, 2021
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

lttlrck / gist:9628955
Created Mar 18, 2014
rename git branch locally and remotely
View gist:9628955
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote