Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Neal jonathantneal

View GitHub Profile
View harlem-shake.js
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
@jonathantneal
jonathantneal / Instructions.md
Last active Mar 8, 2016 — forked from daneden/Instructions.md
Remap right ALT key to Emoji on Mac
View Instructions.md

Remapping the right ALT key to open the emoji selector on Mac

  1. Install Karabiner
  2. Open Karabiner and go to Misc & Uninstall -> Open private.xml
  3. Use the contents of private.xml and save
  4. In Karabiner, go to Change Keys -> Reload XML
  5. Enable “Option_R to Emoji”
  6. 🎉
@jonathantneal
jonathantneal / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jonathantneal
jonathantneal / gist:4149524
Created Nov 26, 2012 — forked from eduardolundgren/gist:4149429
XMLFormatter from Kaleo Designer
View gist:4149524
var STR_CHAR_CRLF = '\r\n';
var STR_BLANK = '';
var STR_CHAR_TAB = '\t';
var repeat = function(str, length) {
return new Array(length + 1).join(str);
};
var XMLUtil = {
REGEX_TOKEN_1: /(>)\s*(<)(\/*)/g,
@jonathantneal
jonathantneal / parseCSS.js
Created Jul 10, 2012 — forked from anonymous/parseCSS.js
parseCSS.js // returns parsed CSS text as a JavaScript object
View parseCSS.js
(function (global) {
function clean(css) {
return css
.replace(/\/\*[\W\w]*?\*\//g, "") // remove comments
.replace(/^\s+|\s+$/g, "") // remove trailing spaces
.replace(/\s*([:;{}])\s*/g, "$1") // remove trailing separator spaces
.replace(/\};+/g, "}") // remove unnecessary separators
.replace(/([^:;{}])}/g, "$1;}") // add trailing separators
}
@jonathantneal
jonathantneal / trim-canvas.js
Created Jan 31, 2012 — forked from remy/trim-canvas.js
Trims the surrounding transparent pixels from a canvas
View trim-canvas.js
('HTMLCanvasElement' in this) && (function () {
HTMLCanvasElement.prototype.trim = function (opts) {
opts = opts || {};
var
element = this,
bound = {
top: null,
left: null,
right: null,