Skip to content

Instantly share code, notes, and snippets.

@mass6
mass6 / sortable_table.html
Created January 18, 2017 08:10
JQuery-UI Sortable table
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Sortable - Default functionality</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style>
body {
@mass6
mass6 / phpunit.xml
Last active November 11, 2016 10:24
Setting up phpunit env variables to use sqlite database for testing
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
@mass6
mass6 / database.php
Created November 11, 2016 09:28
Connection type for accessing homestead database from host machine
'mysql-local' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost') . ('homestead' == gethostname() ? null : ':33060'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
@mass6
mass6 / 01.FiniteStateMachine.README.md
Last active August 29, 2017 10:19
Laravel 5.3 Finite State Machine Trait
@mass6
mass6 / 01.EloquentBootSequence.README.md
Last active November 6, 2016 12:29
Eloquent Boot Sequence

Eloquent Boot Sequeence

Demonstrates Laravel's eloquent model boot sequence, including object construction. #

Order of code executed:

  • Static boot method
public static boot(){...}
@mass6
mass6 / FiniteAuditTrailTrait.php
Created October 27, 2016 09:14 — forked from tortuetorche/FiniteAuditTrailTrait.php
FiniteStateMachine and FiniteAuditTrail Traits for Laravel 5.1 (WIP)
<?php namespace App\Finite;
/**
* The FiniteAuditTrail Trait.
* This plugin, for the Finite package (see https://github.com/yohang/Finite), adds support for keeping an audit trail for any state machine.
* Having an audit trail gives you a complete history of the state changes in your stateful model.
* Prerequisites:
* 1. Install Finite package (https://github.com/yohang/Finite#readme)
* 2. Use FiniteStateMachine in your model (https://gist.github.com/tortuetorche/6365575)
* Usage: in your Stateful Class use this trait after FiniteStateMachine trait, like this "use FiniteAuditTrailTrait;".
@mass6
mass6 / 01.FiniteStateMachine.README.md
Created October 27, 2016 09:13 — forked from tortuetorche/01.FiniteStateMachine.README.md
FiniteStateMachine Trait with Example.Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

FiniteStateMachine Trait

Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.

Usage

In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).

Example

@mass6
mass6 / LaravelTrait.php
Last active October 13, 2015 12:25
Laravel 4.2 Trait for working with Behat
<?php
use Illuminate\Foundation\Testing\ApplicationTrait;
use Illuminate\Foundation\Testing\AssertionsTrait;
use Illuminate\Support\Facades\Artisan;
trait LaravelTrait
{
/**
@mass6
mass6 / LaravelTrait.php
Created October 12, 2015 13:30
Laravel 5.1 Trait for working with Behat
<?php
use Illuminate\Foundation\Testing\ApplicationTrait;
use Illuminate\Foundation\Testing\AssertionsTrait;
use Illuminate\Foundation\Testing\CrawlerTrait;
use Illuminate\Support\Facades\Artisan;
trait LaravelTrait
{
@mass6
mass6 / PhpUnitAssertionsTrait.php
Created October 11, 2015 20:19
Wrapper for PHPunit Assertions
<?php
trait PhpUnitAssertionsTrait
{
/**
* Asserts that an array has a specified key.
*
* @param mixed $key
* @param array|ArrayAccess $array