This file contains hidden or 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() { | |
})(); |
This file contains hidden or 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($) { | |
})(jQuery); |
This file contains hidden or 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 twitter style time ago from supplied timestamp | |
* @param timestamp $timestamp [description] | |
* @return string [description] | |
*/ | |
public static function howLongAgo($timestamp) { | |
$difference = time() - $timestamp; | |
if($difference >= 60*60*24*365){ // if more than a year ago | |
$int = intval($difference / (60*60*24*365)); |
This file contains hidden or 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 throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
This file contains hidden or 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 msToTime(s) { | |
function addZ(n) { | |
return (n<10? '0':'') + n; | |
} | |
var ms = s % 1000; | |
s = (s - ms) / 1000; | |
var secs = s % 60; | |
s = (s - secs) / 60; |
This file contains hidden or 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
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Base64 = { | |
// private property |
This file contains hidden or 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
/** | |
* | |
* URL encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Url = { | |
// public method for url encoding |
This file contains hidden or 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
/** | |
* | |
* MD5 (Message-Digest Algorithm) | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var MD5 = function (string) { | |
function RotateLeft(lValue, iShiftBits) { |
This file contains hidden or 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
<?php | |
function generatePassword($length=9, $strength=0) { | |
$vowels = 'aeuy'; | |
$consonants = 'bdghjmnpqrstvz'; | |
if ($strength & 1) { | |
$consonants .= 'BDGHJLMNPQRSTVWXZ'; | |
} | |
if ($strength & 2) { | |
$vowels .= "AEUY"; |
This file contains hidden or 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
/** | |
* | |
* PHP validate email | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
function isValidEmail($email){ | |
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email); | |
} |
OlderNewer