Skip to content

Instantly share code, notes, and snippets.

Michael Rienstra mrienstra

Block or report user

Report or block mrienstra

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
mrienstra / unregisterServiceWorkers.js
Created Feb 4, 2018
Unregister service workers, verbose
View unregisterServiceWorkers.js
navigator.serviceWorker.getRegistrations().then(function (registrations) {
if (!registrations.length) {
console.log('No serviceWorker registrations found.')
for(let registration of registrations) {
registration.unregister().then(function (boolean) {
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' +
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') +
View export_postprocess.js
const replace = require('replace-in-file'); //
const path = require('path');
const scriptName = path.basename(process.argv[1]);
const options = {
files: [
View script_tag.js
window.Attribution = window.Attribution || [];
window.Attribution.methods = ["trackSubmit", "trackClick", "trackLink", "trackForm", "pageview", "identify", "group", "track", "ready", "alias", "page", "once", "off", "on"];
window.Attribution.factory = function(e) {
return function() {
var t =;
return window.Attribution
View ratchetSliderSetPage.js
/* ========================================================================
* ratchetSliderSetPage
* ========================================================================
* Compatible with gh:twbs/ratchet v2.0.2
* Licensed under MIT (
* ======================================================================== */
mrienstra / Rearrange Desktop Icons.scpt
Last active Aug 11, 2019
Rearranges Desktop icons to flow from left to right, top to bottom.
View Rearrange Desktop Icons.scpt
-- Based on
-- Inspired by
-- Rearranges Desktop icons to flow from left to right, top to bottom.
-- To have this run automatically every time files are added or removed from the Desktop, set this script to run as a Desktop "Folder Action". (See )
-- This is currently a rough proof-of-concept. It has only been tested with OS X 10.8.5 (Mountain Lion).
mrienstra / README
Created Oct 3, 2012
Demo of hacks to prevent scroll-triggered navigation
The first approach use several layers. It takes advantage of the fact that you cannot trigger a "back" unless BODY's "scrollLeft" is 0. The disadvantage to this approach is the appearance of an additional horizontal scrollbar. There may also be some subtle side-effects to using "position: fixed".
1. The HTML element acts as a container for the BODY element, and uses "overflow: scroll".
2. The BODY element is 2 pixels wider than the page, so it can scroll 1px in either direction when its "scrollLeft" is 1 (neutral position).
3. We bind to the "onscroll" event of the window, and reset BODY's "scrollLeft" to 1.
4. The content is inside a DIV, which uses "position: fixed" so it doesn't jump around when the BODY is scrolling.
The second approach uses the hash / history stack. Rather than trying to stop a "back" or "forward", we simply "buffer" the history stack so that we can detect any changes and return to our neutral position.
1. When we load the page, we change the hash to "#previous", then "#neutral", then
View gist:1905551
var PersonModel = Backbone.Model.extend();
var PersonView = Backbone.View.extend({
initialize: function () {
this.model.bind('change:name', _.bind(this.render, this));
render: function () {
View gist:1905442
window.person = new Person;
var myCallback = function(personModel, enteredName) {
alert(‘Hello’ + enteredName);
person.bind('change:name', myCallback);
View director_example2.htm
<!DOCTYPE html>
<meta charset="utf-8">
<title>A Gentle Introduction 2</title>
<script src=""></script>
<script src=""></script>
mrienstra / gist:1793969
Created Feb 10, 2012
First attempt at writing a .rst for three.js, in particular docs/api/renderers/CanvasRenderer.rst
View gist:1793969
CanvasRenderer - Renderer for Canvas
.. ...............................................................................
.. rubric:: Constructor
.. ...............................................................................
.. class:: CanvasRenderer( parameters )
Renderer for Canvas
You can’t perform that action at this time.