Skip to content

Instantly share code, notes, and snippets.


Dan MacTough danmactough

View GitHub Profile
tomhicks / plink-plonk.js
Last active Oct 17, 2020
Listen to your web pages
View plink-plonk.js
danmactough /
Created Jul 31, 2015
Setting up a gpu (nvidia) ec2 instance with ubuntu and electron for headless webgl rendering
#!/bin/bash -xe
# Unload nouveau
sudo rmmod nouveau
# Load nvidia
sudo modprobe nvidia
# Configure X
sudo nvidia-xconfig --use-display-device=None --virtual=1280x1024 --output-xconfig=/etc/X11/xorg.conf --busid=PCI:0:3:0 --enable-all-gpus
rvagg / gist:96c959b7c31eedfa2c5c
Last active Aug 29, 2015
100 most downloaded npm packages for the period 6-Jul-2014 to 6-Aug-2014
View gist:96c959b7c31eedfa2c5c
1: async (5,306,139)
2: mkdirp (3,989,808)
3: request (3,822,748)
4: glob (3,750,793)
5: minimatch (3,476,898)
6: commander (3,475,471)
7: debug (3,454,917)
8: qs (3,372,442)
9: inherits (3,105,353)
10: graceful-fs (3,005,257)
JamieMason / annotated-jshintrc.txt
Created Jun 13, 2014
An annotated .jshintrc file, based on the docs at
View annotated-jshintrc.txt
* Tell JSHint about global variables.
"predef": [
mikeal / install.bash
Last active Jan 28, 2020
Find and install latest node from source on Ubuntu.
View install.bash
echo "Finding latest version."
VERSION=`curl -s | awk '/node-v/ {print $2}' | head -1 | sed s/node-v// | sed s/-/\ / | awk '{print $1}'`
echo "Preparing to install node-v$VERSION"
echo "GET" $url
curl $url | tar -zxf -
trevnorris /
Last active Feb 18, 2020
Quick steps of how to create a flame graph using perf

The will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading )
sudo sysctl kernel.perf_event_paranoid=0
insin / BootstrapModalMixin.js
Last active Mar 25, 2019
A Bootstrap (3) modal mixin for React / MIT License
View BootstrapModalMixin.js
/** @jsx React.DOM */
var BootstrapModalMixin = function() {
var handlerProps =
['handleShow', 'handleShown', 'handleHide', 'handleHidden']
var bsModalEvents = {
handleShow: ''
, handleShown: ''
, handleHide: ''
sindresorhus / post-merge
Last active Oct 17, 2020
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#!/usr/bin/env bash
# MIT © Sindre Sorhus -
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
View waitforit.js
// Optional `options. Stuff like retry count, ramp-up, etc.
// should have sane defaults.
var wait = waitforit(options, function (cb) {
// This would be the 'test' function.
// cb(true) when 'it' is done.
wait.on('ready', function () {
// Do something because the test condition passed.
rektide /
Last active Dec 15, 2015
Promises are about Getting Rid of a Phase Distinction - A crude guide to what makes Promises Actually Different than every other tool.

A promise is a value, and values are by definition not machines.

Phase Distinctions, Machines, Higher Order Functions,

Tools for composing systems

In CS: a phase distinction is a boundary code goes through on it's way to being run. We write the prime artifact, "the code," but to run a machine, this code is transformed by machines, often many machines transforming, taking whatever the current code is, making decisions about what that code looks like, what it represents, and outputting a new code closer to the final execution target. This is the compilation pipeline goes go through to get executed on the target machine. Phase distinction is applied to types, as types change as code goes through the pipeline, but in general all aspects of the code are going through phasal distinctions as they become closer to being run.

Higher order functions: composing complexity

Async- the most popular library on the planet for helping to deal with functional programming- is a library dedicated to composing functio

You can’t perform that action at this time.