This file contains 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
// backbone.js continues to impress, I needed to get data from a jsonp api | |
// I really wanted to do this the "right" backbone.js way and create a model and call fetch. | |
// But the default backbone synch is not jsonp | |
// Turns out you can override a synch on a per model basis (thanks stackoverflow) | |
// whats nice is backbone.js continue to work as expected with the override | |
// here's a snippet (some changes to protect our privacy). An improvement could be to create a jsonp model class which MyModel inherits | |
// the synch function is most important below, that's what tells backbone it's jsonp | |
MyModel = Backbone.Model.extend({ |
This file contains 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 () { | |
// ... all vars and functions are in this scope only | |
// still maintains access to all globals | |
}()); |
This file contains 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 compileTemplates = function() { | |
_.each(App.Views, function(View) { | |
if (View.prototype.templateId) { | |
// The templateId references the id of a DOM element containing | |
// the content of the template | |
var html = jQuery('#' + View.prototype.templateId).html() || ''; | |
View.prototype.template = _.template(html); | |
} | |
}); | |
} |
This file contains 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 QueryStringTest extends PHPUnit_Framework_TestCase { | |
/** | |
* @covers remove_querystring_var | |
*/ | |
public function testRemoveQueryStringVar() { | |
// tests without any other querystring params |
This file contains 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
// Place your settings in this file to overwrite the default settings | |
{ | |
"editor.fontFamily": "Operator Mono SSm", | |
// Enables font ligatures | |
"editor.fontLigatures": true, | |
// Controls whether the editor should render whitespace characters | |
"editor.renderWhitespace": "all" | |
} |
This file contains 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 | |
TIMEOUT = 20000 | |
lastTime = (new Date()).getTime() | |
setInterval -> | |
currentTime = (new Date()).getTime() | |
# If timeout was paused (ignoring small | |
# variations) then trigger the 'wake' event | |
if currentTime > (lastTime + TIMEOUT + 2000) |
This file contains 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
# Install linux update, followed by GCC and Make | |
sudo yum -y update | |
sudo yum install -y gcc make | |
# Install Nginx and PHP-FPM | |
sudo yum install -y nginx php-fpm | |
# Install PHP extensions | |
sudo yum install -y php-devel php-mysql php-pdo \ | |
php-pear php-mbstring php-cli php-odbc \ |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
OlderNewer