This file contains hidden or 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
// bookmarklet, logGlobals | |
javascript:console.log(function(d,i,s,c,o){i=(d=document).body.appendChild(s=d.createElement('iframe')).contentWindow,c=Object.create(null);d.body.removeChild(s);for(o in this)o in i||(c[o]=this[o]);return c}()) |
This file contains hidden or 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 () { | |
'use strict'; | |
var _slice = Array.prototype.slice; | |
try { | |
_slice.call(document.documentElement); // Can't be used with DOM elements in IE < 9 | |
} | |
catch (e) { // Fails in IE < 9 | |
Array.prototype.slice = function (begin, end) { | |
var i, arrl = this.length, a = []; |
This file contains hidden or 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
/* | |
* Fiddle : http://jsfiddle.net/nzmwfufk/ | |
* Réf : https://developer.mozilla.org/en-US/docs/Web/API/NodeList#A_.22live.22_collection | |
*/ | |
/* test page : "chrome://apps/" 01/10/2013 */ | |
var divs = document.querySelectorAll("div"); | |
console.log('avant : ' + divs.length + ' items'); |
This file contains hidden or 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Alex Kloss <[email protected]> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains hidden or 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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains hidden or 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(d,e){ | |
w=d.createTreeWalker(d.body,4);while(n=w.nextNode())n.data=n.data.replace(e,'') | |
})(document, /[\w\d\.()=;,'{}/]/gi); |
This file contains hidden or 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
var myDOM = (function(){ | |
var myDOM = function(elems){ | |
return new MyDOMConstruct(elems); | |
}, MyDOMConstruct = function(elems) { | |
this.collection = elems[1] ? Array.prototype.slice.call(elems) : [elems]; | |
return this; | |
}; | |
myDOM.fn = MyDOMConstruct.prototype = { | |
forEach : function(fn) { | |
var elems = this.collection; |
This file contains hidden or 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
// run this function to update the spinning globe for another iteration | |
var updateWorld = function updateWorld() { | |
var e, x, r, t; | |
var newSource = "<pre>"; | |
var worldParts = [ | |
"zw2", | |
"l6k\n", | |
"e3t", | |
"jnt", | |
"qj2", |
This file contains hidden or 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 r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()} |
This file contains hidden or 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
console.log(extractTagNamesES5('<a> and <b> or <c>')); // [ 'a', 'b', 'c' ] | |
// If exec() is invoked on a regular expression whose flag /g is set | |
// then the regular expression is abused as an iterator: | |
// Its property `lastIndex` tracks how far along the iteration is | |
// and must be reset. It also means that the regular expression can’t be frozen. | |
var regexES5 = /<(.*?)>/g; | |
function extractTagNamesES5(str) { | |
regexES5.lastIndex = 0; // to be safe | |
var results = []; |