Skip to content

Instantly share code, notes, and snippets.

Alex Wilson arextar

Block or report user

Report or block arextar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arextar
arextar / parse.js
Created Jun 14, 2011
Color parsing tool (little more optimized for speed this time)
View parse.js
parse=function(a,b,c){function d(a,b,c){return(c+=c<0?1:c>1?-1:0,c<1/6?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a)*255}return function(e,f,g,h,i){return a[e]=a[e]?a[e]:b.test(e)?(e=b.exec(e)[1].split(","),[~~e[0],~~e[1],~~e[2]]):e.charAt(0)=="#"?(e=b.exec(e)[1].split(","),[~~e[0],~~e[1],~~e[2]]):c.test(e)?(e=c.exec(e),g=+e[1]/360,h=+e[2]/100,i=+e[3]/100,h==0?[i,i,i]:(h=i<.5?i*(1+h):i+h-i*h,i=2*i-h,[d(i,h,g+1/3),d(i,h,g),d(i,h,g-1/3)])):[0,0,0]}}({},/rgb\((.+)\)/,/hsl\(([0-9]+),([0-9]+)%?,([0-9]+)%?\)/)
@arextar
arextar / Module.js
Created Mar 25, 2011
Modules in commented blocks
View Module.js
(function () {
var executed = {}
this.Module = function (name, data) {
var w = String.fromCharCode(9000),
t = document.documentElement.innerHTML.replace(/\*\//g, w),
a = new RegExp("/\\*\\n?(\\-|\\+)Module:" + name + "\\(?([^\\)]+)?\\)?([^" + w + "]+)" + w).exec(t)
You can’t perform that action at this time.