Skip to content

Instantly share code, notes, and snippets.

Michael Sanford michaelsanford

Block or report user

Report or block michaelsanford

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View batch-webp.ps1
Get-ChildItem -File *.png | Foreach { cwebp.exe -short -noalpha -lossless $_.Name -o ($_.BaseName + ".webp") }
View angular-cache-service.js
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Rx';
interface CacheContent {
expiry: number;
value: any;
* Cache Service is an observables based in-memory cache implementation
michaelsanford / .jshintrc
Last active May 7, 2017 — forked from ScheerMT/.jshintrc
.jshintrc for ES6, updated for jshint 2.9 with every available option (no deprecations), without comments
View .jshintrc
"bitwise" : true,
"curly" : true,
"eqeqeq" : true,
"esversion" : 6,
"forin" : true,
"freeze" : true,
"funcscope" : false,
"futurehostile" : true,
"iterator" : false,
package com.greatwebguy.filter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
michaelsanford / pizza.js
Last active Jan 27, 2017
Will there be pizza? 👍🏽🍕
View pizza.js
(() => {
"use strict";
* Attendees to JS-Montreal often don't know if there will be pizza or not. This aims to make it more clear.
* Traditionally, pizza is available if the meetup starts at 6 PM, but not if it starts at 7.
* @see
michaelsanford /
Last active Oct 18, 2016
Interactively delete local branches which have been merged upstream. In my case, that's into `develop`.
statistics() {
echo "Remaining local branches:"
git branch
echo "These local branches are not merged into ${MERGED_INTO}:"
michaelsanford / harpa-js-is.js
Created Aug 25, 2016
JSConfIS Northern Lights JS IS - Dance Party
View harpa-js-is.js
const { totalCols } = config
function update(currentLights, time) {
const colIndex = Math.round(time * 20 % totalCols)
const newLights = new Lights()
const colour = Color().hsl(time * 200 % 360, 100, 50)
const offsets = [1, 15, 29, 43];
michaelsanford /
Created May 25, 2016
Email when a DNS change has propagated to a certain nameserver.
#!/usr/bin/env bash
# The IP to which you just updated your DNS
# The domain for which you're awaiting propagation
# Polling interval in seconds
michaelsanford / nuke-mysql-conditional-comments
Last active Aug 29, 2015
Nuke mysql conditional comment markers in vim
View nuke-mysql-conditional-comments
Two vim editor commands to nuke mysql conditional comment markers in
MySQL dumps, but not the statement within them:
: %s/\/\*!\d\+\s//g
: %s/\*\///g
Or you can use sed:
sed -i 's/\/\*!\d\+\s//g' dump.sql
sed -i 's/\*\///g' dump.sql
michaelsanford /
Last active Aug 29, 2015
Android screenshot (Glass, Wear, mobile)
#!/usr/bin/env bash
# Screencaps, pulls, and deletes the png from a device.
# gcap [w | a | device identifier]
# For debugging over Bluetooth (i.e., Android Wear), see
You can’t perform that action at this time.