Skip to content

Instantly share code, notes, and snippets.

View spiralx's full-sized avatar

James Skinner spiralx

View GitHub Profile
@spiralx
spiralx / keys.js
Created June 13, 2014 01:55
Browser keyboard codes JavaScript object
// Individual key code mappings - noy character codes!
var Keys = {
BACKSPACE: 8,
TAB: 9,
RETURN: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
BREAK: 19,
CAPS_LOCK: 20,
@spiralx
spiralx / mutation-summary.js
Created August 16, 2014 06:58
mutation-summary.js library
// Copyright 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@spiralx
spiralx / umd-example-browser-demo.html
Last active February 11, 2024 22:56
Universal Module Definition example - AMD, CommonJS and browser support in the same file
<!DOCTYPE html>
<html>
<head>
<title>AMD/CommonJS/Browser Module Wrapper Demo</title>
</head>
<body>
<h1>AMD/CommonJS/Browser Module Wrapper Demo</h1>
<p>Module core.plugins not loaded</p>
@spiralx
spiralx / github-npm-autolink.user.js
Last active August 29, 2015 14:05
GitHub package.json dependency linker
@spiralx
spiralx / facebook-so-what.user.js
Created August 27, 2014 21:08
Silly user script
// ==UserScript==
// @id [email protected]
// @name Facebook So Hwæt
// @version 0.0.1
// @namespace http://spiralx.org/facebook-what
// @author James Skinner <[email protected]> http://github.com/spiralx
// @match https://*.facebook.com/*
// @match https://facebook.com/*
// @exclude */ai.php*
// @run-at document-end
@spiralx
spiralx / jquery-mutation-summary.js
Created October 31, 2014 01:55
jquery-mutation-summary.js
/*!
* @license jquery-mutation-summary
* Copyright © 2012, 2013, 2014, Joel Purra <http://joelpurra.com/>
* Released under MIT, BSD and GPL license. Comply with at least one.
*
* A jQuery wrapper/plugin for mutation-summary, the DOM mutation-observers wrapper.
* http://joelpurra.github.com/jquery-mutation-summary
*
* "Mutation Summary is a JavaScript library that makes observing changes to the DOM fast, easy and safe."
* http://code.google.com/p/mutation-summary/
@spiralx
spiralx / mono.css
Created February 16, 2015 23:49
CSS for bookmarklet popups
body {
font: 12px/1.5 Consolas,monospace;
}
h3 a {
font-size: 1.2em;
color: #000;
}
a {
display: inline-block;
@spiralx
spiralx / utils.js
Created February 24, 2015 13:51
Various small utility functions for user scripts
;(function(name, definition) {
var moduleObj = definition();
// AMD Module
if (typeof define === 'function') {
define(moduleObj);
}
// CommonJS Module
else if (typeof module !== 'undefined' && module.exports) {
module.exports = moduleObj;
@spiralx
spiralx / gulpfile-suspend-watcher.js
Last active December 15, 2016 23:37
Gulp - suspend watcher during task execution
var gulp = require('gulp');
function doGitCheckout(callback) {
console.log('doing checkout...');
setTimeout(function() {
console.log('done checkout...');
callback();
}, 1000);
}
@spiralx
spiralx / Bash.md
Created April 8, 2015 14:25
Shell scripting cheat-sheets

BASH cheat-sheet

Redirects and pipes

# Send stdout to stderr
ll 1>&2

# Send stderr to stdout
ll 2>&1