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 () { | |
var forEach = [].forEach, | |
regex = /^data-(.+)/, | |
dashChar = /\-([a-z])/ig, | |
el = document.createElement('div'), | |
mutationSupported = false, | |
match | |
; | |
function detectMutation() { |
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 () { | |
function detectMutation() { | |
mutationSupported = true; | |
this.removeEventListener('DOMAttrModified', detectMutation, false); | |
} | |
var forEach = [].forEach, | |
regex = /^data-(.+)/, | |
el = document.createElement('div'), | |
mutationSupported = false; |
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
// Loads js files | |
function loadScripts(urlArray,cb) { | |
var scriptLoadCount = scriptLoadedCount = 0; | |
loadScript(); | |
function loadScript() { | |
var head= document.getElementsByTagName('head')[0]; | |
var script= document.createElement('script'); | |
script.type= 'text/javascript'; | |
var url = (urlArray[scriptLoadCount].indexOf('?') == -1) ? urlArray[scriptLoadCount] + '?d=' + Math.random() : urlArray[scriptLoadCount] + '&d=' + Math.random() |
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
//check if click event firing twice on same position. | |
var last_click_time = new Date().getTime(); | |
function gc(e){ | |
var click_time = e['timeStamp']; | |
if (click_time && (click_time - last_click_time) < 1000) { | |
e.stopImmediatePropagation(); | |
return false; | |
} | |
last_click_time = click_time; | |
return true; |
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 returns appropriate event type for device based | |
// on the parameter passed to the function | |
var et = function(t) { | |
var msPointer = window.navigator.msPointerEnabled; | |
var isTouchDevice = (typeof(window.ontouchstart) != 'undefined') ? true : false; | |
var clickArray = ['c','click','mousedown','down','touchstart']; | |
var releaseArray = ['r','release','up','mouseup','touchend']; | |
var moveArray = ['m','move','mousemove','touchmove','drag']; | |
var eventType = ''; |
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 X = function () { | |
var self = this; | |
Object.defineProperty(self, 'abc', {get: function () { return 1; }}); | |
}; | |
// Extending & closing the loop | |
X.prototype = Array.prototype; | |
X.prototype.constructor = X; | |
// Works as you'd expect |
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 | |
/** | |
* Description of VideoStream | |
* | |
* @author Rana | |
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial | |
*/ | |
class VideoStream | |
{ | |
private $path = ""; |
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
/** | |
* CSS Selector Hacks. | |
*/ | |
/* IE6 and below */ | |
* html #uno { color: red } | |
/* IE7 */ | |
*:first-child+html #dos { color: red } | |
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 | |
$regions = new Regions('General'); | |
$regions->add('North', 54.5742270, -1.2349560); | |
$regions->add('North West', 53.9690089, -2.6276908); | |
$regions->add('East Anglia', 52.6308859, 1.2973550); | |
$regions->add('Midlands', 52.6368778, -1.1397592); | |
$regions->add('Wales', 52.1306607, -3.7837117); | |
$regions->add('South East', 50.7680350, 0.2904720); | |
$regions->add('Scotland', 56.4906712, -4.2026458); | |
$regions->add('South West', 50.7772135, -3.9994610); |
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 | |
/* | |
This is a very tiny proof-of-concept SMTP client. Currently it's over 320 characters (if the var names are compressed). Think you can build one smaller? | |
*/ | |
ini_set('default_socket_timeout', 3); | |
$user = '[email protected]'; | |
$pass = ''; | |
$host = 'ssl://smtp.gmail.com'; |