Skip to content

Instantly share code, notes, and snippets.

function dyslexia(string){return String.fromCharCode.apply(this,string.split('').map(function(a){return a.charCodeAt()^255;}))}
var a = "{lives:3}";
var z = dyslexia(a);
a == dyslexia(z);
@PAEz
PAEz / evIl.js
Created July 13, 2014 10:06
evIl
var evIl = function(script) {
blob = new Blob([script], {
type: "application/javascript"
});
url = window.URL.createObjectURL(blob);
s = document.createElement('script');
s.src = url;
document.head.appendChild(s);
window.URL.revokeObjectURL(url);
s.parentElement.removeChild(s);
@PAEz
PAEz / gist:c4a2f2f5f0f7f627eb1a
Created August 28, 2014 13:07
glfx blend modes
function blend(element,blendMode,opacity) {
// this._.extraTexture.loadContentsOf(element);
// this._.extraTexture.use(1);
element._.use(1);
if(gl.blend == undefined){
var shader= (function () {
/*
Reserved words
--------------
Width
Height
X
Y
Scale - not used yet but will be used to declare the scalling method and details (slice and all that)
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
@PAEz
PAEz / LineIntersection.js
Created January 14, 2015 07:35
Check Line Intersection
// http://jsfiddle.net/justin_c_rounds/Gd2S2/
function checkLineIntersection(startX1, startY1, endX1, endY1, startX2, startY2, endX2, endY2, result) {
// if the lines intersect, the result contains the x and y of the intersection (treating the lines as infinite) and booleans for whether line segment 1 or line segment 2 contain the point
var denominator, a, b, numerator1, numerator2, result = result || {
x: 0,
y: 0,
onLine1: false,
onLine2: false
};
denominator = ((endY2 - startY2) * (endX1 - startX1)) - ((endX2 - startX2) * (endY1 - startY1));
@PAEz
PAEz / colors.js
Last active August 29, 2015 14:15
Chrome/Skia's Color Routines in JS
function colorToHSL(red, green, blue) {
var luminance, hue, saturation;
red = red / 255;
green = green / 255;
blue = blue / 255;
var vmax = Math.max(Math.max(red, green), blue);
var vmin = Math.min(Math.min(red, green), blue);
var delta = vmax - vmin;
var luminance = (vmax + vmin) / 2;
if (delta > 0) {
function getFnName(fn) {
var f = typeof fn == 'function';
var s = f && ((fn.name && ['', fn.name]) || fn.toString().match(/function ([^\(]+)/));
return (!f && 'not a function') || (s && s[1] || 'anonymous');
}
console.log(getFnName(String)); // 'String'
console.log(getFnName(function test(){})); // 'test'
console.log(getFnName(function (){})); // 'anonymous'
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@PAEz
PAEz / [QtTabBar] Delete Wav file if Flac of same name exists
Last active August 29, 2015 14:23
[QtTabBar] Delete Wav file if Flac of same name exists
Goes through all selected folders (one deep) and checks if a wav file with the same name of a flac files exists and if it does then delete it.
This is my first script for QtTabBar....one of the best extensions to Windows, EVER!
`qs.InvokeCommand( "DeleteFile", fc.item().Path);`
Didnt work for me, complains the command doesnt exist. If I try using the command code of 125 then it doesnt bitch but it doesnt seem to do anything either. Using the fso.DeleteFile worked fine, except it didnt send it to the recycle bin which would have been nice, but I spose theres something for that but didnt look coz its working ;).