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: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
@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: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);
'/test/[!:name]' => function($this) {
if ($this['request']->checkMethod('get')) {
return strtoupper($this['request']->get('name'));
}
}
<% namespace Dotink\Inkwell\View {
/**
*
* @author Matthew J. Sahagian [mjs] <msahagian@dotink.org>
* @param $users The array of users
* @param
*/
if ($this['wtf'] == 'test'):
<?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(){
@mattsah
mattsah / Mime.php
Last active December 10, 2015 22:29
<?php namespace Dotink\Jest {
class Mime extends Jest
{
/**
*
*/
static private $parents = array();
@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 / gist:3231836
Created August 2, 2012 00:16
Namespacing Concepts
\Dotink\Flourish\
# Loaded from /includes/lib/flourish via:
#
# 'autoloaders' => array(
# '\Dotink\Flourish\*' => 'COMPAT:includes/lib/flourish'
# )
ORM
ActiveRecord
@mattsah
mattsah / gist:3210863
Created July 30, 2012 22:10
Agile Development and REST?
REST is software design on the scale of decades: every detail is intended to promote software longevity and independent evolution. Many of the constraints are directly opposed to short-term efficiency. Unfortunately, people are fairly good at short-term design, and usually awful at long-term design. Most don’t think they need to design past the current release. There are more than a few software methodologies that portray any long-term thinking as wrong-headed, ivory tower design (which it can be if it isn’t motivated by real requirements).