This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a bookmark and use this code as the URL, you can now toggle the css on/off | |
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
javascript: (function() { | |
var elements = document.body.getElementsByTagName('*'); | |
var items = []; | |
for (var i = 0; i < elements.length; i++) { | |
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { | |
items.push(elements[i]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(scope, console, CustomEvent) { | |
var error = scope.error = function() { | |
var output = [] | |
for (var i=0; i<arguments.length; i++) { | |
var arg = arguments[i]; | |
if (typeof arg === "object" && arg.length) { | |
output.push.apply(output, Array.prototype.slice.call(arg)); | |
} else { | |
output.push(arg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.X = {}; | |
function fnName(fn){ | |
if (!fn){ return null; } | |
if (fn.name){ return fn.name; } | |
var s = fn.toString().match(/ \w+/); | |
return s && s[0].substring(1); | |
} | |
function xType(name, type) { | |
if (name in X) { | |
return X[name]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(document) { | |
var flex = { | |
tagName: 'TEXTAREA', | |
attribute: 'autosize', | |
buffer: 20, | |
events: 'input propertychange change', | |
adjust: function(el, shrunk) { | |
var height = el.scrollHeight, | |
style = el.style; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(scope) { | |
var resolve = scope.resolve = function(reference, context) { | |
if (resolve.RE.test(reference)) { | |
return resolve.unsafe(reference, context); | |
} | |
}; | |
resolve.RE = /^([\w\$]+)?((\.[\w\$]+)|\[(\d+|'(\\'|[^'])+'|"(\\"|[^"])+")\])*$/; | |
resolve.unsafe = function(reference, context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this gives HTMLified nodes 'click' if not defined already | |
HTML._.fn.click = function() { | |
var e = document.createEvent('MouseEvent'); | |
e.initMouseEvent('click', true, true); | |
el.dispatchEvent(e); | |
}; | |
// call it like so: | |
HTML.find('.foo').each('click'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function define(object, key, fn, force) { | |
if (force || !(key in object)) {// unless we're forcing the issue, avoid already defined keys | |
(setImmediate || setTimeout)(function() {// do it asynchronously to not interrupt other initialization | |
try {// suppress errors when the property isn't configurable | |
Object.defineProperty(object, key, { value: fn });// define the new one to be non-enumerable and non-configurable | |
} catch (e) {} | |
}, 0); | |
} | |
}; | |
// if you really want to get fancy, you could use promises or callbacks to resume init after this is defined. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diff(a, b) { | |
var diffs = {}; | |
for (var k in a) { | |
if (!(k in b)) { | |
console.log('b is missing '+k, a[k]); | |
diffs[k] = "missing"; | |
} else if (a[k] != b[k]) { | |
var av = a[k], bv = b[k]; | |
try { | |
if (JSON.stringify(av) != JSON.stringify(bv)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2012, ESHA Research | |
* Dual licensed under the MIT and GPL licenses: | |
* http://www.opensource.org/licenses/mit-license.php | |
* http://www.gnu.org/licenses/gpl.html | |
* | |
* @version 0.4 | |
* @requires jQuery | |
* @name state | |
* @author Nathan Bubna |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) 2012, ESHA Research | |
* | |
* @version 0.1 | |
* @name key | |
* @requires jQuery | |
* @author Nathan Bubna | |
*/ | |
;(function($, window, document) { |
NewerOlder