Skip to content

Instantly share code, notes, and snippets.

View willishq's full-sized avatar
😺
Swiping Cats

Andrew Willis willishq

😺
Swiping Cats
View GitHub Profile
@willishq
willishq / Flash.php
Last active August 18, 2019 12:07
Laravel 5 Flash messages inspired by Laracasts Flash, optimized for Zurb Foundation
<?php namespace App\Services;
use Illuminate\Session\Store;
/**
* Laravel 5 Flash messages inspired by Laracasts Flash Messages.
*
* @link https://github.com/laracasts/flash
*
* @author Andrew Willis <[email protected]>
*
@willishq
willishq / tags-input.jquery.js
Created January 27, 2015 21:35
Simple input tags jQuery snippet
Array.prototype.remove = function (value) {
return this.filter(function (element) {return element !== value});
};
var tags = [];
$('.tag-box').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('.tag-input', this).focus();
});
$('.tag-input').on('keyup', function (e) {
@willishq
willishq / EloquentBaseModel.php
Last active January 2, 2016 17:09
This is my Eloquent Base Model which I use to turn off timestamps as a default and also to add validation as a method on each model.
<?php
class BaseModel extends Eloquent
{
public $timestamps = false;
/**
* Validation rules
*
* @var array
@willishq
willishq / inactive.php
Last active December 29, 2015 15:58
Adding active timestamps to Eloquent
<?php
namespace Extreloquent;
use Illuminate\Database\Eloquent\Builder;
/**
* Extension of the Eloquent model to add active dates to data
*
* Class Model
@willishq
willishq / robot.js
Created December 3, 2012 20:34
WillisBot
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot){
this.offset = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;