Skip to content

Instantly share code, notes, and snippets.

View colinrotherham's full-sized avatar

Colin Rotherham colinrotherham

View GitHub Profile
@colinrotherham
colinrotherham / Preferences.sublime-settings
Last active December 12, 2018 11:55
Latest settings, switch to Material theme
{
"auto_find_in_selection": true,
"binary_file_patterns":
[
"*.min.js",
"*.min.css",
"*.sql",
"*.map",
"node_modules/",
"bower_components/"
@colinrotherham
colinrotherham / Millionaire
Last active August 29, 2015 14:02
PHP to JSON output for “Who Wants to Be a Millionaire?”
<?php
/*
Question list
----------------------------------- */
$questions = array
(
(object) array
(
@colinrotherham
colinrotherham / scrollCancel
Created July 15, 2014 09:29
Cancel a scroll animation (e.g. you don't need to fight against JS trying to scroll you up/down)
// Use these events to cancel a scroll in progress
var scrollEvents = 'scroll mousedown DOMMouseScroll mousewheel keyup touchstart pointerdown MSPointerDown';
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26260989-4']);
_gaq.push(['_setCustomVar', 1, 'A-B Test Variant', 'A', 1]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
@colinrotherham
colinrotherham / proxy-pass
Created June 25, 2015 11:49
Nginx proxy pass
upstream somewhere
{
server localhost:4000;
}
server
{
location /
{
try_files $uri @proxy;
@colinrotherham
colinrotherham / is-touch.js
Created December 2, 2016 15:47
Touch enabled?
return ('ontouchstart' in window) || navigator.msPointerEnabled || window.DocumentTouch && document instanceof DocumentTouch;
@colinrotherham
colinrotherham / iterm-profile
Created January 6, 2017 11:28
iTerm custom profile
{
"Badge Text" : "",
"Working Directory" : "\/Users\/Colin\/Sites\/",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Red Component" : 0.2274509817361832,
"Color Space" : "Calibrated",
"Blue Component" : 0.294117659330368,
"Alpha Component" : 1,
"Green Component" : 0.2470588237047195
@colinrotherham
colinrotherham / npm-debug.log
Created June 1, 2017 13:06
Running npm@5.0.1 behind proxy with self-signed root CA certificate
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.0.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install' ]
2 info using npm@5.0.1
3 info using node@v8.0.0
4 silly install runPreinstallTopLevelLifecycles
5 silly preinstall @scope/project-name@0.1.11
6 info lifecycle @scope/project-name@0.1.11~preinstall: @scope/project-name@0.1.11
7 silly lifecycle @scope/project-name@0.1.11~preinstall: no script for preinstall, continuing
// Output raw video frames (ppm file)
gource -f -1280x720 --stop-at-end --disable-progress -e 0.006 --bloom-multiplier 0.70 --multi-sampling --auto-skip-seconds 1 --seconds-per-day 0.5 --output-ppm-stream - > ~/Desktop/filename.ppm &
// Generate video from frames
ffmpeg -f image2pipe -vcodec ppm -i ~/Desktop/filename.ppm -an -pass 1 -vcodec libx264 -b 1000000 -pix_fmt yuv420p -threads 0 ~/Desktop/filename.mp4
@colinrotherham
colinrotherham / greeter.js
Last active August 31, 2017 13:32
Example ES6 class
import Etiquette from './lib/etiquette';
import message from './lib/message';
class Greeter extends Etiquette {
constructor (config) {
super();
this.intro = config.intro;
this.name = config.name;