You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
// Very simple. Just handles the process of | |
// display an unordered list of movies, | |
// while providing the ability to edit each movie | |
// and update the model. | |
// Any glaring bad practices? Still in the early | |
// Backbone learning stages. | |
(function(Movie) { |
<?php | |
$template = "I am {{name}}, and I work for {{company}}. I am {{age}}."; | |
# Your template tags + replacements | |
$replacements = array( | |
'name' => 'Jeffrey', | |
'company' => 'Envato', | |
'age' => 27 | |
); |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
// Which do you prefer more? | |
// trigger event and get out | |
var vent = _.extend({}, Backbone.Events); | |
App.Router = Backbone.Router.extend({ | |
routes: { | |
'show/:id': 'show' | |
}, | |
show: function(id) { |
<?php | |
class BaseModel extends Eloquent { | |
public static function shouldReceive() | |
{ | |
$repo = get_called_class() . 'RepositoryInterface'; | |
$mock = Mockery::mock($repo); | |
App::instance($repo, $mock); |
<?php | |
// ... | |
public function testProtected() | |
{ | |
$dateFormatter = new DateFormatter; | |
$class = new \ReflectionClass('DateFormatter'); |
<?php | |
# ignore | |
use \Way\Console\Guardfile; | |
use Mockery as m; | |
class GuardfileTest extends \PHPUnit_Framework_TestCase { | |
public function testCanOverrideDefaultPath() | |
{ |
<?php | |
class MyMailer { | |
public function deliver() | |
{ | |
// This facade doesn't need to be injected into the class. | |
Mail::send('emails.welcome', [], function($m) | |
{ | |
$m->to('[email protected]') | |
->subject('Welcome to the site') |