I hereby claim:
- I am lewisje on github.
- I am lewisje (https://keybase.io/lewisje) on keybase.
- I have a public key ASCMAUXVxmtQRyrx40JOErH18pznSvs4snXEkDzo4-SLKQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(function (document) { | |
'use strict'; | |
/* | |
* LODASH in-Browser JSON transformer | |
* Use this in a bookmarket (save its contents in a bookmark) and whenever you open a JSON response (e.g. https://www.reddit.com/.json) | |
* you can use it to test lodash methods against the data. | |
* Lodash is exposed on window as _ and "json" global variable contains the data within the browser window. | |
* | |
* Copy the line below and save it as the url of a new bookmark (it's the same code as below but minified for bookmark use): | |
* javascript:!function(e){"use%20strict";function%20t(){s=JSON.parse(j.innerText||j.textContent),y.src=p,y.onload=n,e.head.appendChild(y)}function%20n(){window.json=JSON.parse(JSON.stringify(s)),i(window.json),m.oninput=o,e.body.appendChild(m),e.body.appendChild(x)}function%20o(e){var%20t,n=e||event,o=n.target||n.srcElement;return%20o.value?(t=a(o.value),void(t&&"object"==typeof%20t?(r(o,"success"),i(t)):r(o,"error"))):(i(s),void%20r(o,"success"))}function%20i(e){j.innerText?j.innerText=JSO |
// https://web.archive.org/web/20141119215047/http://jsperf.com/javascript-quicksort-comparisons | |
// based on work from Vladimir Yaroslavskiy: https://web.archive.org/web/20151002230717/http://iaroslavski.narod.ru/quicksort/DualPivotQuicksort.pdf | |
var dualPivotQuicksort = (function (Math, toString, undefined) { | |
'use strict'; | |
function swap(arr, i, j) { | |
var temp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = temp; | |
} | |
function dualPivotQuicksort(arr, comp, left, right, div) { |
var nodeInsertion = (function (document, undefined) { | |
'use strict'; | |
function noop() {} | |
var result = {add: noop, remove: noop}; | |
if (typeof String.prototype.trim !== 'function') return result; // Every browser that supports animations also has String#trim | |
// a stylesheet that holds our special keyframe code: https://davidwalsh.name/add-rules-stylesheets | |
var animName = ('node_' + Math.random() + '_inserted').split('.').join(''), sheet = (function () { | |
var style = document.createElement('style'); | |
style.appendChild(document.createTextNode(['@-o-','@-moz-', '@-webkit-', '@', ''].join('keyframes ' + |
// Here is a JSFiddle with a concrete example: https://jsfiddle.net/SeanJM/rg3ftcgk/1/ | |
// This is one of Sean's most leveraged functions, which he uses to keep my code nice and modular | |
function fnChain(target, source, args) { | |
'use strict'; | |
var objProto = Object.prototype, hasOwn, chain, k; | |
if (objProto.toString.apply(args) !== '[object Array]') { | |
throw new TypeError('Invalid argument for "fnChain": The 3rd argument must be an array of arguments.'); | |
} | |
hasOwn = objProto.hasOwnProperty; | |
chain = function chain(k) { |
javascript:document.documentElement.innerHTML='<plaintext>'+document.documentElement.innerHTML; |
// part of a pair of functions intended to isolate code that kills the optimizing compiler | |
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#2-unsupported-syntax | |
function functionize(func, arg) { | |
switch (typeof func) { | |
case 'string': | |
return arg ? new Function(String(arg), func) : new Function(func); | |
case 'function': | |
return func; | |
default: | |
return function () {return func;}; |