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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
function pixel8(image, x, y, w, h) { | |
"use strict"; | |
// Image must be an image, canvas, or video | |
// For videos: Pixel data of the currently displayed frame will be extracted |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
(function (window, document, Date, undefined) { | |
"use strict"; | |
function createAJAXObject () { | |
if (window.XMLHttpRequest) return new XMLHttpRequest(); |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
RegExp.prototype.exec2 = function(str) { | |
if (this.global) { | |
var result = []; | |
var tm; |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
Array.prototype.cycle = function() { | |
return this[this.push(this.shift()), 0]; | |
}; | |
/* |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
(function(window, location) { | |
var re = /(&|\?)([^&?=]+)=([^&?=]+)/g; | |
var fre = /^function\s*\w*\(([^)]*)\)\s*\{([^}]*)\}$/; |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
Array.shuffle = function (array) { | |
var top, i, temp; | |
top = array.length; | |
while (top !== 0) { |
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) 2013 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
function addEventListeners (sel, evt, fun, cap) { | |
var els; | |
if (sel.length) els = sel; | |
else document.querySelectorAll(sel); | |
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) 2014 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
CanvasRenderingContext2D.prototype.drawHTML = function(src, x, y, cb) { | |
if (src.nodeType) src = src.outerText; | |
var svg = new Blob(["\ | |
<svg xmlns='http://www.w3.org/2000/svg' width='" + this.canvas.width + "' height='" + this.canvas.height + "'>\ |
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) 2014 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
function pwd () { | |
return location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1); | |
} | |
var getCurrentDirectory = pwd; |
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) 2014 Rohit Vighne | |
License: The MIT License (MIT) | |
*/ | |
var prefixProp = function(document, undefined) { | |
var test = document.createElement('div'); | |
var prefixes = ["-webkit-", "-moz-", "-ms-", "-o-"]; | |
var length = prefixes.length; |
OlderNewer