Skip to content

Instantly share code, notes, and snippets.

View muhamed-didovic's full-sized avatar
😎

Muhamed muhamed-didovic

😎
View GitHub Profile
// 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('jeffrey@foo.com')
->subject('Welcome to the site')
(function($){
$(function(){
var $form = $('#search'), // Search form
$target = $('#results'), // Results container
rp = 'search/ajax-results'; // Template for results only
// Function to execute on success
var success = function(data, status, xhr) {
$target.html(data);
};
function AjaxForm($el) {
this.$form = $el;
this.form = $el[0]; // Internal state via properties
this.$form.on('submit', $.proxy(this.submit, this));
};
AjaxForm.prototype = {
submit: function(e) { // Named Functions
e.PreventDefault();
var this = this;
(function() {
$.fn.ajaxify = function(options) {
$(this).submit(function(e) {
var form = $(this);
$.ajax({
type : form.attr('method'),
url : form.attr('action'),
data : form.serialize(),
error : options.error,
success : options.success,