Skip to content

Instantly share code, notes, and snippets.

View imbcmdth's full-sized avatar

Jon-Carlos Rivera imbcmdth

View GitHub Profile
var width = null;
var height = null;
window.onload = function () {
var windowSize = getSize();
width = windowSize['width'];
height = windowSize['height'];
window.onscroll = function(){ alert("Hello"); }
};
// ==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
@imbcmdth
imbcmdth / huh.js
Created May 15, 2013 21:49
Wisp vs Wisp's Idea of JavaScript vs real JavaScript
// 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)))
(function(global){
var exeQueue = [];
exeQueue.insertOrdered = function(val) {
var l = this.length,
order = val.order;
while(l--) {
if(this[l].order > order) break;
}
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; })); } });
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){
@imbcmdth
imbcmdth / content
Last active December 17, 2015 16:19 — forked from pcamp96/content
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);
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
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;
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