Skip to content

Instantly share code, notes, and snippets.

View colinrotherham's full-sized avatar

Colin Rotherham colinrotherham

View GitHub Profile
@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 / proxy-pass
Created June 25, 2015 11:49
Nginx proxy pass
upstream somewhere
{
server localhost:4000;
}
server
{
location /
{
try_files $uri @proxy;
<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 / 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';
@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 / 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/"