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
/** | |
* JS OVERRIDES | |
*/ | |
(function (window) { | |
'use strict'; | |
String.prototype.trim = function (str) {return this.ltrim(str).rtrim(str); }; | |
String.prototype.ltrim = function (str) { return this.replace(new RegExp('^' + (str ? str : '\\s') + '+'), ''); }; | |
String.prototype.rtrim = function (str) { return this.replace(new RegExp((str ? str : '\\s') + '+$'), ''); }; | |
String.prototype.ucfirst = function () { |
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
(2500).toLocaleString("en-GB", {style: "currency", currency: "GBP", minimumFractionDigits: 2}) |
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
function encrypt(text){ | |
var cipher = crypto.createCipher('aes-256-cbc','d6F3Efeq') | |
var crypted = cipher.update(text,'utf8','hex') | |
crypted += cipher.final('hex'); | |
return crypted; | |
} | |
function decrypt(text){ | |
var decipher = crypto.createDecipher('aes-256-cbc','d6F3Efeq') | |
var dec = decipher.update(text,'hex','utf8') |
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
/* From Modernizr */ | |
function whichTransitionEvent() { | |
var el = document.createElement('fakeelement'), t, | |
transitions = { | |
'transition': 'transitionend', | |
'OTransition': 'oTransitionEnd', | |
'MozTransition': 'transitionend', | |
'WebkitTransition': 'webkitTransitionEnd', | |
'MsTransition': 'msTransitionEnd' | |
}; |
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
$({ a:0 }).animate({ a:.3 },{ | |
duration: 1000, | |
step: function(){ | |
// do something | |
}, | |
complete: function(){ | |
} | |
}); |
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
/* DATE FUNCTIONS */ | |
Date.months = [ | |
{ shortName: 'jan', days: 31, name: 'January' }, | |
{ shortName: 'feb', days: 28, name: 'February' }, | |
{ shortName: 'mar', days: 31, name: 'March' }, | |
{ shortName: 'apr', days: 30, name: 'April' }, | |
{ shortName: 'may', days: 31, name: 'May' }, | |
{ shortName: 'jun', days: 30, name: 'June' }, | |
{ shortName: 'jul', days: 31, name: 'July' }, | |
{ shortName: 'aug', days: 31, name: 'August' }, |
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
console.log('%cERROR: %c siema %c tom', | |
'font: bold 12px arial; color:red; line-height:2.6em;', | |
'font: 12px arial; color:green;', | |
'font: 12px arial; color:blue;' | |
); |
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
String.prototype.fuzzy = function (s) { | |
var hay = this.toLowerCase(), i = 0, n = -1, l; | |
s = s.toLowerCase(); | |
for (; l = s[i++] ;) if (!~(n = hay.indexOf(l, n + 1))) return false; | |
return true; | |
}; | |
('a haystack with a needle').fuzzy('hay sucks'); // false | |
('a haystack with a needle').fuzzy('sack hand'); // true |
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
_getUrlVars = function () { | |
var vars = {}, | |
parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { | |
vars[key] = value; | |
}); | |
return vars; | |
} |
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
fail | |
f (![]+[])[+[]] | |
a (![]+[])[+!+[]] | |
i ([![]]+[][[]])[+!+[]+[+[]]] | |
l (![]+[])[!+[]+!+[]] | |
t (!![]+[])[+[]] | |