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 getImageLightness(imageSrc,callback) { | |
var img = document.createElement("img"); | |
img.src = imageSrc; | |
img.style.display = "none"; | |
document.body.appendChild(img); | |
var colorSum = 0; | |
img.onload = function() { | |
// create canvas |
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
var Scheduler = (function () { | |
var tasks = []; | |
var minimum = 10; | |
var timeoutVar = null; | |
var output = { | |
add: function (func, context, timer, once) { | |
var iTimer = parseInt(timer); | |
context = context && typeof context === 'object' ? context : null; | |
if(typeof func === 'function' && !isNaN(iTimer) && iTimer > 0) { | |
tasks.push([func, context, iTimer, iTimer * minimum, once]); |
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 removeClass(elements, myClass) { | |
// if there are no elements, we're done | |
if (!elements) { return; } | |
// if we have a selector, get the chosen elements | |
if (typeof(elements) === 'string') { | |
elements = document.querySelectorAll(elements); | |
} |
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 addClass(elements, myClass) { | |
// if there are no elements, we're done | |
if (!elements) { return; } | |
// if we have a selector, get the chosen elements | |
if (typeof(elements) === 'string') { | |
elements = document.querySelectorAll(elements); | |
} |
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
/* | |
* Define UI Elements | |
* ------------------------------------------------*/ | |
Application.Directives.uiPreloader = function () { | |
return { | |
restrict: 'AE', | |
scope: {}, | |
transclude: true, | |
template: '<div data-ng-transclude></div>', |
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
// ref: http://stackoverflow.com/a/1293163/2343 | |
// This will parse a delimited string into an array of | |
// arrays. The default delimiter is the comma, but this | |
// can be overriden in the second argument. | |
function CSVToArray( strData, strDelimiter ){ | |
// Check to see if the delimiter is defined. If not, | |
// then default to comma. | |
strDelimiter = (strDelimiter || ","); |
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 | |
/* | |
Plugin name: Single user login | |
Plugin URI: | |
Description: | |
Author: Ben May | |
Author URI: http://benmay.org/wordpress/single-user-wordpress/ | |
Version: 0.1 | |
*/ | |
if( !class_exists( 'WPSingleUserLoggin' ) ) |
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 _validate_passport( passport ) { | |
//Utils._strict( [ String ], arguments ); // Thirdparty Function | |
//trim | |
passport = passport.replace( /(^\s+|\s+$)/g, '' ); | |
var passport_characters = passport.split(''); | |
if( passport_characters.length == 9 ) { |
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 getStartAndEndDate($week, $year) | |
{ | |
$time = strtotime("1 January $year", time()); | |
$day = date('w', $time); | |
$time += ((7*$week)+1-$day)*24*3600; | |
$return[0] = date('Y-n-j', $time); | |
$time += 6*24*3600; | |
$return[1] = date('Y-n-j', $time); | |
return $return; |
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
/** | |
* Matches: 0111231234 | 011 123 1234 | 011-123-1234 | 0821231234 | +27821231234 | +2782-123-1234 | +2782 123 1234 | 27111231234 | 2711 123 1234 | 2711-123-1234 | |
* Non-Matches: (011)1231234 | (+2711) 123 1234 | (011) 123-1234 | |
/**/ | |
var pattern2 = new RegExp(/^((?:\+27|27)|0)(\d{2})-?(\d{3})-?(\d{4})$/); | |
console.log( pattern2.test( '+27134622241' ) ); |
NewerOlder