Skip to content

Instantly share code, notes, and snippets.

View psyrendust's full-sized avatar

Larry Gordon psyrendust

View GitHub Profile
@psyrendust
psyrendust / gitpatch.sh
Created October 27, 2016 18:23
GitHub patching script
#!/usr/bin/env bash
#
# gitpatchit - Easily create a patch and apply it to a destination branch.
#
# Create a patch file between a current branch and a destination branch. Then
# test and apply the patch to a temp branch. Finally rebase the temp branch onto
# the destination branch and cleanup the patch file and remove the temp branch.
#
# Usage:
# gitpatchit -h
@psyrendust
psyrendust / wheel-event-polyfill.js
Created February 3, 2016 03:18 — forked from starstuck/wheel-event-polyfill.js
Mouse 'wheel' event polyfill for webkit browsers
/**
* Mouse wheel polyfill inspired by cross-browser example on mdn wiki.
*
* It supports relatively modern browsers, which already support addEventListener and Array forEach methods.
* Effectively it is targeting webkit based browsers. I didn't have opportunity to test it on old Firefox.
* Method addEventListener is supported in IE9, which already supports wheel event. I guess one could combine
* it with polyfill for addEventListener to have support in IE 6-8. In that case one would have to also wrap
* all addEventListener methods provided by the polyfill (last block below).
*
* @see https://developer.mozilla.org/en-US/docs/Web/Reference/Events/wheel?redirectlocale=en-US&redirectslug=DOM%2FMozilla_event_reference%2Fwheel#Listening_to_this_event_across_browser
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet prefetch" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style type="text/css">
body .popover {
max-width: 830px;
}
</style>
@psyrendust
psyrendust / elementChange.js
Created November 17, 2015 20:44
Add and remove MutationObserver events to a registered DOM element.
/**
* @typedef MutationCallback
* @param {NodeList} addedNodes A NodeList of elements that have been added to the DOM.
* @param {NodeList} removedNodes A NodeList of elements that have been removed from the DOM.
*/
/**
* Add a MutationObserver to a DOM node.
*
* @example
*
@psyrendust
psyrendust / docs.js
Created November 9, 2015 17:47
gulp build for esdoc
// location: gulp/tasks/docs.js
const gulp = require('gulp');
const esdoc = require('gulp-esdoc');
const newer = require('gulp-newer');
const plumber = require('gulp-plumber');
const esdocJSON = require('../../esdoc.json');
const logger = require('../util/logger');
const esdocOptions = Object.assign({}, esdocJSON, {
@psyrendust
psyrendust / Queue.js
Created November 4, 2015 00:54
Browserify + Babelify Issue
/**
* Creates a queue that persists after calling `apply()`.
*/
export class PersistentQueue {
_queue = [];
_size = 0;
constructor() {}
onUpdate(callback) {
@psyrendust
psyrendust / npm-debug.log
Created October 2, 2015 01:07
Error: Refusing to delete - OS X 10.11, npm @3.3.5, node @4.1.0 (works with npm @2.14.6)
0 info it worked if it ends with ok
1 verbose cli [ '/Users/larrygordon/.nvm/versions/node/v4.1.0/bin/node',
1 verbose cli '/Users/larrygordon/.nvm/versions/node/v4.1.0/bin/npm',
1 verbose cli 'prune',
1 verbose cli '--production' ]
2 info using npm@3.3.5
3 info using node@v4.1.0
4 verbose unbuild node_modules/alter
5 verbose unbuild node_modules/acorn-to-esprima
6 verbose unbuild node_modules/amdefine
@psyrendust
psyrendust / Favorite-Sublime-Plugins.md
Last active August 29, 2015 14:13
My favorite Sublime Text plugins

Productivity Plugins

  • Case Conversion: Case conversion plugin (pascal, camel, snake) for sublime text 2 & 3.
  • Inc-Dec-Value: Increase / decrease of numbers, dates, hex color values, etc.
  • DocBlockr: Simplifies writing DocBlock comments in Javascript, PHP, CoffeeScript, Actionscript, C & C++.
  • Insert Nums: Sublime Text plugin for inserting sequences. Supporting alphanumerics and hex, with bitwise operations!

SublimeLinter Plugins

@psyrendust
psyrendust / remove-node.sh
Last active May 8, 2019 18:27
Remove Node and NPM from OS X and Linux
#!/usr/bin/env bash
#
# remove-node.sh
#
# Find and remove all traces of Node and NPM from OS X and Linux.
# Log all file deletions to ~/remove_node_YYYY_MM_DD_HH_MM_SS.log
#
# Author:
# Larry Gordon
#
@psyrendust
psyrendust / colortest.bat
Created August 2, 2014 02:10
Testing colored output from a windows batch file running in cmd.exe
@echo off
:: Testing color output in a batch script
:: Rendering is slow, but you get pretty colors
call:logblue "-- blue"
call:loggreen "-- green"
call:logcyan "-- cyan"
call:logred "-- red"
call:logmagenta "-- magenta"
call:logyellow "-- yellow"