Skip to content

Instantly share code, notes, and snippets.

View lewisje's full-sized avatar
💭
I may be slow to respond.

James Edward Lewis II lewisje

💭
I may be slow to respond.
View GitHub Profile
@lewisje
lewisje / lodash_browser_json_transformer.js
Last active April 3, 2016 09:43 — forked from monostere0/lodash_browser_json_transformer.js
Lodash in-browser JSON transformer (should work back to IE6)
(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
@lewisje
lewisje / fnChain.js
Last active February 22, 2016 04:23 — forked from SeanJM/fnChain.js
A function which allows the augmentation of an Object with functional methods.
// 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) {