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 width = null; | |
var height = null; | |
window.onload = function () { | |
var windowSize = getSize(); | |
width = windowSize['width']; | |
height = windowSize['height']; | |
window.onscroll = function(){ alert("Hello"); } | |
}; |
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
// ==UserScript== | |
// @name Tatoeba Flexible Linker | |
// @namespace http://userscripts.org/users/515236 | |
// @description Inserts a box below a Tatoeba sentence that the user can fill with the number or URL of a sentence, as well as buttons that allow the user to visit the new sentence or link it to the first one. Extends Zifre's "Tatoeba Linker" script. | |
// @author AlanF_US | |
// @include http://tatoeba.org/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js | |
// @version 1.0 | |
// ==/UserScript== | |
// NOTE: All functions used in the script must be added to the line below |
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
// Wisp: | |
(fn sum | |
"Return the sum of all arguments" | |
{:version "1.0"} | |
([] 0) | |
([x] x) | |
([x y] (+ x y)) | |
([x & more] (more.reduce (fn [x y] (+ x y)) x))) |
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(global){ | |
var exeQueue = []; | |
exeQueue.insertOrdered = function(val) { | |
var l = this.length, | |
order = val.order; | |
while(l--) { | |
if(this[l].order > order) break; | |
} |
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 slots = [], num = 1000; for(var i = 0; i < num; i++) setTimeout(function(s, d, done){ slots[s] = Date.now() - d; done(); }, 1000, i, Date.now(), function(){ if(!--num) { console.log("Mean:", slots.reduce(function(p, c, i) { var d = c - p; return p + d / i; })); } }); |
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
AJAXRequest: function(url, action){ | |
/* ---------------------- | |
Small AJAX Library | |
------------------------- */ | |
xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function(){ | |
// check if the request is ready and the status is ok | |
if (xhr.readyState === 4 && xhr.status === 200){ |
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 isMobile = { | |
tests:[ | |
function() { | |
return navigator.userAgent.match(/Android/i); | |
}, | |
function() { | |
return navigator.userAgent.match(/BlackBerry/i); | |
}, | |
function() { | |
return navigator.userAgent.match(/iPhone|iPad|iPod/i); |
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
redact.js>node redact.js US forces are moving into turkey on a crazy whim to find terrorist twitter users | |
US ██████ are ██████ into ██████ on a █████ whim to ██████████████ twitter users |
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 hugeNum = Math.pow(2, 51); | |
function generateArguments(numberOfArgs) { | |
var letters = []; | |
while(numberOfArgs--) letters.push("arg_" + Math.ceil(Math.random() * hugeNum)); | |
return letters; | |
} | |
Function.prototype.partial = function partial() { | |
var fn = this; |
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
The meadowlark and the chim-choo-ree and the sparrow | |
Set to the sky in a flying spree, for the sport of the pharaoh | |
A little while later the Pharisees dragged a comb through the meadow | |
Do you remember what they called up to you and me in our window? | |
There is a rusty light on the pines tonight | |
Sun pouring wine, lord, or marrow | |
Down into the bones of the birches | |
And the spires of the churches | |
Jutting out from the shadows |