Skip to content

Instantly share code, notes, and snippets.

View jonathantneal's full-sized avatar

Jonathan Neal jonathantneal

View GitHub Profile
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 March 8, 2016 16:20 — forked from daneden/Instructions.md
Remap right ALT key to Emoji on Mac

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 August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// 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 November 26, 2012 17:28 — forked from eduardolundgren/gist:4149429
XMLFormatter from Kaleo Designer
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 July 10, 2012 22:24 — forked from anonymous/parseCSS.js
parseCSS.js // returns parsed CSS text as a JavaScript object
(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 January 31, 2012 06:18 — forked from remy/trim-canvas.js
Trims the surrounding transparent pixels from a canvas
('HTMLCanvasElement' in this) && (function () {
HTMLCanvasElement.prototype.trim = function (opts) {
opts = opts || {};
var
element = this,
bound = {
top: null,
left: null,
right: null,