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
/** | |
* Returns a string in which all 3 after a number exceeded a point is set. | |
* @param {String,Number} | |
* @example pointSeperatorHelper(1234567) // -> "1.234.567" | |
* @return {String} | |
*/ | |
function pointSeperatorHelper (value) { | |
value = String(value); | |
var regExp = new RegExp('(-?[0-9]+)([0-9]{3})'); | |
while(regExp.test(value)) { |
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
/** Define primitives type for better compression */ | |
var FALSE = false, | |
TRUE = true, | |
NULL = null, | |
window = self, | |
undefined; | |
/** | |
* Extension of Array Mootools class | |
*/ |
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
/** | |
* Twitter message String | |
* Searches in a string for links, replies, and hash and generates a <a>-Tag for the results. | |
* @param {String} message | |
* @return {String} | |
*/ | |
function generateLinks ($message) { | |
$pattern[0] = '/(http:\/\/[0-9a-z-_.\/]+)/i'; # find is urls | |
$pattern[1] = '/@([0-9a-z-_]+)/'; # find is replies | |
$pattern[2] = '/#([0-9a-z-_]+)/'; # find is hashes |
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
var Application = $.inherit({ | |
__constructor: function(){ | |
this._initClock(); | |
}, | |
_initClock: function(){ | |
if($.browser.msie || $.browser.opera){ | |
return false; | |
} | |
var elements = { |
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
// set custom event | |
var name = 'paste'; | |
$.fn[name] = function(fn) { | |
return fn ? this.bind(name, fn) : this.trigger(name); | |
}; | |
// prevented paste event | |
$('#mySelector').bind(name, function(){ | |
return !1; // false | |
}) |
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
/** | |
* Mashup of jquery.pyte and jquery.customdata for Component-based plugins | |
* load classes from JavaScript. | |
* @see http://github.com/psyk/jquery-pyte | |
* @see http://github.com/ubilabs/jquery-customdata | |
* | |
* @example | |
* <!-- DOM structure --> | |
* <div id="myComponent" data-jsc="module.MyComponent">component content</div> | |
* |
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
/** | |
* #learnjs | |
* Check if a given year is leap year. | |
* @param {int} [year] Year to be evaluated. If no date is used defines the client year. | |
* @return {boolean} Returns <em>true</em> is year a leap year, otherwise <em>false</em>. | |
*/ | |
function isLeapYear (year) { | |
return (new Date(year || (new Date).getFullYear(), 1, 29, 0, 0).getMonth() != 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
/** | |
* #learnjs | |
* Find the largest, or smallest, number in an array. | |
*/ | |
var a = [-88, 4, 2, 0, 9, 1, 8]; | |
Math.max.apply(Math, a); // 9 | |
Math.min.apply(Math, a); // -88 |
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
/** | |
* #learnjs | |
* Generate unique random alphanumeric strings | |
* @return {int} length | |
*/ | |
function passGen(length) { | |
var str = '', | |
randomChar = function () { | |
var num = Math.floor(Math.random() * 62), | |
charCodeNum = (num < 36) ? num + 55 : num + 61; |
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
/** | |
* #learnjs | |
* Find and remove an element from an array #learnjs | |
*/ | |
Array.prototype.remove = function (item) { | |
var pos = this.indexOf(item); | |
if (pos != -1) { | |
this.splice(pos, 1); | |
} | |
} |
OlderNewer