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
| <div id="fb-text">Like us on Facebook for the very latest updates, exclusives, offers and competitions!</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
| <div id="tw-text">Come and join us on Twitter!</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
| <?php | |
| class TestClass{ | |
| private $tests = array('Pass'=>0,'Fail'=>0); | |
| public function test($expected, $actual){ | |
| if($expected === $actual){ | |
| return $this->tests['Pass'] += 1; | |
| } else { | |
| return $this->tests['Fail'] += 1; | |
| } |
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 loadBackupScript(callback){ | |
| if (typeof callback !== 'function') { | |
| throw 'Not a valid callback'; | |
| } | |
| var script = document.createElement('script'); | |
| script.src = 'http://www.geoplugin.net/javascript.gp'; | |
| script.type = 'text/javascript'; | |
| script.onload = callback; | |
| var head = document.getElementsByTagName("head")[0]; | |
| head.appendChild(script); |
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 is_touch_device() { | |
| return !!('ontouchstart' in window) // works on most browsers | |
| || !!('onmsgesturechange' in window); // works on ie10 | |
| }; |
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 eachAsync(collection, iterator, callback) { | |
| var iterate = function(i) { | |
| setTimeout(function() { | |
| iterator(collection[i]); | |
| if (i < collection.length) { | |
| iterate(i + 1); | |
| } else { | |
| callback(); | |
| } | |
| }, 0); |
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
| jQuery.fn.center = function() { | |
| this.css({ | |
| 'position': 'fixed', | |
| 'left': '50%', | |
| 'top': '50%' | |
| }); | |
| this.css({ | |
| 'margin-left': -this.outerWidth() / 2 + 'px', | |
| 'margin-top': -this.outerHeight() / 2 + 'px' | |
| }); |
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
| #!/usr/bin/php | |
| <?php | |
| $projectName = basename(getcwd()); | |
| exec('phpunit', $output, $returnCode); // Assuming cwd here | |
| if ($returnCode !== 0) { | |
| $minimalTestSummary = array_pop($output); | |
| printf("Test suite for %s failed: ", $projectName); | |
| printf("( %s ) %s%2\$s", $minimalTestSummary, PHP_EOL); | |
| return false; // exit(1); | |
| } |
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 today = new Date(); // By default brings backs tweets only in the last hour. Or just use new Date('Fri Jul 05 13:35:22 +0000 2013'), with a fixed cut off time, to have tweets within the specified time-frame only | |
| // If you do not want the hourly window to change (otherwise "today" will become a moving target of tweets in the last hour each time tweet counter runs, then please put this line at the top of the file, inside the .ready function as follows: | |
| // $(document).ready(function(){ var today = new Date(); }) | |
| // Making sure that the variable is defined outside of the var tweetCounter function | |
| // Lets go through each tweet | |
| for (obj in data.statuses) { | |
| var tw_result = data.statuses[obj]; // This is the tweet | |
| var tw_unique_id = tw_result.id_str; // This is the id of the tweet |
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
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |