Skip to content

Instantly share code, notes, and snippets.

View mattsah's full-sized avatar

Matthew J. Sahagian mattsah

View GitHub Profile
@mattsah
mattsah / gist:3260631
Created August 4, 2012 23:43
A better underscorize method?
<?php
$tests = [
'FavoriteURL',
'URLHelper',
'FavoriteURLs',
'AmazingURLsFromSpace',
'FavoriteURLHelper',
'FBIManBob',
'removeXMLTags',
@mattsah
mattsah / Mime.php
Last active December 10, 2015 22:29
<?php namespace Dotink\Jest {
class Mime extends Jest
{
/**
*
*/
static private $parents = array();
<?php namespace Dotink\Jest {
include 'Mime.php';
Mime::define('App\Test')->implementing('IFake')
-> extending('App\TestBase')->implementing('IFakeBase');
$test = Mime::create('App\Test')
-> onNew('factory', function($mime) {
$mime -> onCall('speak') -> give(function(){
<% namespace Dotink\Inkwell\View {
/**
*
* @author Matthew J. Sahagian [mjs] <[email protected]>
* @param $users The array of users
* @param
*/
if ($this['wtf'] == 'test'):
'/test/[!:name]' => function($this) {
if ($this['request']->checkMethod('get')) {
return strtoupper($this['request']->get('name'));
}
}
@mattsah
mattsah / gist:5561492
Created May 11, 2013 21:31
prettify var_export for php 5.4
$config = preg_replace('#=>\s*array \(#', '=> [', $config);
$config = preg_replace('#\),#', '],', $config);
$config = preg_replace('#,(\s*)\]#', '$1]', $config);
$config = preg_replace('#\d+ => #', '', $config);
$config = preg_replace('#\[\s+\]#', '[]', $config);
$config = str_replace(' ', "\t", $config);
@mattsah
mattsah / gist:9676106
Created March 20, 2014 23:15
Don't Forget What PHP Can Do
<?php
function ★() {
echo "You're a star! \n";
}
★();
@mattsah
mattsah / gist:9198bb5d350c79af3c90
Created June 15, 2015 17:30
Scaffolded from Redub
<?php namespace Redub\Base {
class Person extends \Redub\ORM\Model
{
/**
* Fetch the values of the related groups from the database
*
* @access public
* @return Collection The groups values