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'; |
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 | |
| // Place the DB files outside of the public web directory so people don't download it! | |
| define('DB', 'links.sq3'); | |
| // Number of seconds a user must wait to post another link (false to disable) | |
| define('WAIT', false); | |
| // Should we enforce IP checking? (false to disable) | |
| define('IP_CHECK', 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
| <?php | |
| define('START_TIME', microtime(TRUE)); | |
| register_shutdown_function(function() { | |
| print dump(round(microtime(TRUE) - START_TIME, 3) . ' seconds'); | |
| print dump(round(memory_get_peak_usage() / 1024) . " kb peak usage"); | |
| print dump(DB::$q); | |
| }); |
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 | |
| /** | |
| * Parse the text with *limited* markdown support. | |
| * | |
| * @param string $text | |
| * @return string | |
| */ | |
| function markdown_limited($text) | |
| { | |
| // Make it HTML safe for starters |