Skip to content

Instantly share code, notes, and snippets.

@0xMatt
0xMatt / Repository.php
Last active August 29, 2015 14:10
Laravel 5 Repositories
<?php
namespace Lithe\Database;
use Illuminate\Database\Eloquent\Model;
use Lithe\Contracts\Database\RepositoryInterface;
use Illuminate\Contracts\Container\Container;
abstract class Repository implements RepositoryInterface
{
<?php
namespace LaravelCms\Theme;
class Theme
{
/**
* Theme constructor
*
* @return void
* @access public
<?php
use LaravelCms\Mvc\Resolver;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
@0xMatt
0xMatt / gist:85da048d46dd04212699
Created June 17, 2014 18:19
Effective column splitting
<?php
echo '<table border="1"><tr>';
foreach(range(1,20) as $key => $row)
{ echo '<td>'. $row . '</td>';
if(++$key % 5 == 0 ) echo '</tr><tr>';
}
echo '</td></table>';
@0xMatt
0xMatt / gist:3996cd73992957fec6e4
Created June 16, 2014 18:41
Iterate over indexed array and group evey two values into associative array
<?php
$array = ['string1', 'string2', 'string3'];
$obj = new ArrayObject( $array );
$it = $obj->getIterator();
$new = [];
while($it->valid())
@0xMatt
0xMatt / Breadcrumb.php
Created June 12, 2014 14:59
My breadcrumb classs
<?php namespace 0xMatt\Breadcrumb;
use View;
class Breadcrumb
{
// ---------------------------------------------
// Class Properties
// ---------------------------------------------