Skip to content

Instantly share code, notes, and snippets.

View kirkbushell's full-sized avatar

Kirk Bushell kirkbushell

  • Tectonic Digital
  • Sydney
View GitHub Profile
var registration = {
create: function() {
var status = null;
var data = {
id: '',
status: ''
};
this.setStatus = function(value) {
@servers(['web' => '111.111.111.111'])
@task('deploy')
cd /var/www
git pull origin master
composer install
php artisan migrate
@endtask
@kirkbushell
kirkbushell / interceptor.js
Created June 11, 2014 15:27
Angular JS HTTP response interceptor
/**
* Interceptor
* Implements functionality to catch various requests and fire events when they happen. This is generally to ensure
* that responses from the server are handled in a uniform fashion across the application. Also, by firing events
* it allows to have any number of handlers attach to the response.
*
* @author Kirk Bushell
* @date 28th March 2013
*/
var module = angular.module('core.interceptor', []);
@kirkbushell
kirkbushell / gulpfile.js
Created August 24, 2014 21:23
Gulpfile for Laravel 4 projects, with a complete assets workflow
// Load all the required plugins.
var gulp = require('gulp'),
notify = require('gulp-notify'),
exec = require('gulp-exec'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename');
var input = 'assets/',
@kirkbushell
kirkbushell / gist:0a7477ad371b285554b9
Created October 8, 2014 20:01
Deferred service provider overloading other deferred provider objects
class ValidationServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
public function register()
class UsersServiceProvider extends ServiceProvider
{
/**
* Defer until needed.
*/
public $defer = true;
/**
* Repositories defined by the users module.
*
@kirkbushell
kirkbushell / Kernel.php
Last active August 29, 2015 14:16
Avoid Laravel 5 middleware in tests
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Pipeline\Pipeline;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
<?php namespace Modules\User\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateUserRequest extends FormRequest
{
public function rules()
{
return [
'email' => "required|email|unique:users,email,{$this->user->id}",
@kirkbushell
kirkbushell / Handler.php
Created August 10, 2015 14:43
Custom exception handler
<?php
namespace AwardForce\Library\Exceptions;
use AwardForce\Library\Http\FormInputOutdatedException;
use AwardForce\Library\Http\Messaging;
use AwardForce\Library\Traits\Respondable;
use AwardForce\Modules\Accounts\AccountNotFoundException;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Response;
@kirkbushell
kirkbushell / whatever
Created August 15, 2011 00:06
nested models problem
#models
class Link < ActiveRecord::Base
has_many :link_urls
accepts_nested_attributes_for :link_urls, :allow_destroy => true #, :reject_if => lambda { |a| a[:url].blank? }
end
class LinkUrl < ActiveRecord::Base
belongs_to :link
end