Skip to content

Instantly share code, notes, and snippets.

View zulrang's full-sized avatar

Roger Collins zulrang

View GitHub Profile
function getMiddle(s){
var m = s.length / 2
return s.slice(m - 1 + s.length % 2, m + 1)
}
@zulrang
zulrang / RestControllerTrait.php
Created December 31, 2015 17:57 — forked from beanmoss/RestControllerTrait.php
Playing with Laravel Lumen: simple RESTful trait.
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
trait RestControllerTrait
{
public function index()
{
$m = self::MODEL;
return $this->listResponse($m::all());