Skip to content

Instantly share code, notes, and snippets.

(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@PieterScheffers
PieterScheffers / mysql-docker.sh
Created January 31, 2018 22:05 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
#!/bin/bash
# Custom scripts here
echo "This is an extended entrypoint!"
# Run the original entrypoint located at
# /docker-entrypoint.sh
exec /docker-entrypoint.sh "$@"
@PieterScheffers
PieterScheffers / gist:1afefd1d464897d408eb8c025c426e83
Created May 8, 2017 11:53 — forked from sheepkiller/gist:9740b280ba199cdc5baa
Quickstart : Simple docker-registry on FreeBSD
root@dcoker-registry:/root # pkg install -y py27-supervisor libevent2 py27-pip-1.5.6
Updating repository catalogue
FreeBSD repository is up-to-date
All repositories are up-to-date
pkg: mplayerxp has a missing dependency: win32-codecs
The following 10 packages will be affected (of 0 checked):
New packages to be INSTALLED:
py27-supervisor: 3.0_1,1
py27-meld3: 0.6.8_1
@PieterScheffers
PieterScheffers / scroll-monitor.js
Created March 8, 2017 19:09 — forked from jacob-beltran/scroll-monitor.js
React Performance: Scroll Monitor Example
class ScrollMonitor extends React.Component {
constructor() {
this.handleScrollStart = this.startWatching.bind( this );
this.handleScrollEnd = debounce(
this.stopWatching.bind( this ),
100,
{ leading: false, trailing: true } );
}
componentDidMount() {
@PieterScheffers
PieterScheffers / OpenWithSublimeText3.bat
Created January 2, 2017 09:18 — forked from cstewart90/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@PieterScheffers
PieterScheffers / post-merge
Created May 26, 2016 15:28 — forked from sindresorhus/post-merge
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/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# 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"
@PieterScheffers
PieterScheffers / js-micro.js
Created May 23, 2016 07:45 — forked from yuval-a/js-micro.js
Javascript micro-optimizations
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17
@PieterScheffers
PieterScheffers / agent.cmd
Created April 25, 2016 08:22 — forked from Shoozza/agent.cmd
Make Cmder work with ssh-agent
@ECHO OFF
REM Set default sock file
SET SSH_AUTH_SOCK=/tmp/ssh-agent.sock
REM Check socket is available
IF NOT EXIST "%TMP%\ssh-agent.sock" GOTO:RUNAGENT
REM Check if an ssh-agent is running
FOR /f "tokens=*" %%I IN ('ps ^| grep ssh-agent ^| sed "s/^ *\([0-9]\+\) .*/\1/"') DO SET VAR=%%I