Skip to content

Instantly share code, notes, and snippets.

@rtablada
rtablada / gist:9589842
Created March 16, 2014 21:00
Modification of @fideloper's Validator to allow Model based validations
<?php namespace Initr\Services;
use Illuminate\Validation\Factory as LaravelValidator;
abstract class Validator
{
protected $validator;
protected $data = array();
{
"require": {
"slim/slim": "2.*",
"slim/views": "0.1.*",
"twig/twig": "1.15.0",
"monolog/monolog": "1.7.0",
"resty/resty": "0.6.0",
"vlucas/valitron": "dev-master#e011ab81c43903e73b766620828877b828e65380",
"j4mie/idiorm": "v1.4.1",
"j4mie/paris": "v1.4.2",
@rtablada
rtablada / controllers.md
Last active August 29, 2015 14:00
My thoughts on a CMF

Admin Controller

The admin controller will extend the Laravel base controller and be crazy smart about things. If you return a string or view object, then it will be injected in the content of the BlockCMF admin layout. This allows you to program like a usual Laravel controller with your own internal layouts, sub-views, view composers, and everything and not having to be bothered about remembering to follow some weird API to make sure you inject your view into the layout. Just extend the AdminBaseController and go to town!

API Controllers (Advanced mutations to be implemented later)

@getify
getify / gist:661f707f05e2743d00d2
Created February 10, 2015 23:27
param spread helper
// thanks to @raganwald
function spread(fn) {
return Function.apply.bind( fn, null );
}
function foo(x,y,z) {
console.log(x,y,z);
}
function bar(fn) {
<?php
/*
This User model handles everything related to users. Most of the code is
ommitted, because it's not relevant to this example.
*/
class User
{
public static function loadUserByCredentials($username, $password)
@philsturgeon
philsturgeon / composer.json
Created September 19, 2012 09:37
PHP Image Manipulation
{
"require": {
"illuminate/foundation": ">=1.0.0",
"illuminate/auth": ">=1.0.0",
"illuminate/database": ">=1.0.0",
"illuminate/view": ">=1.0.0",
"amazonwebservices/aws-sdk-for-php": "1.5.*",
"codeguy/upload": "*",
"sybio/image-workshop" : "*",
<?php
$connection = Illuminate\Database\Connectors\ConnectionFactory::make([
'driver' => 'mysql',
'host' => '',
'database' => '',
'username' => '',
'password' => '',
'charset' => '',
'prefix' => '',
@chadclark
chadclark / 01-bg-img-path.scss
Last active December 16, 2015 21:20
A .scss mixin that makes it easy to include a .png fallback for .svg background images when using Modernizr.
// ---------------------------------------------------------------------------------
// CSS Image Paths
// ---------------------------------------------------------------------------------
$bg-img-path: '/path/to/images/'; // Base Path for BG Layout Images
@dhrrgn
dhrrgn / paths.php
Last active December 20, 2015 09:08
A few handy functions for dealing with paths in PHP in a cross-platform environment.
<?php
if ( ! defined('IS_WIN')) {
define('IS_WIN', (DIRECTORY_SEPARATOR === '\\'));
}
/**
* Normalizes and joins path segments in accordance with the current OS standard.
*
* Usage:
*
@Integralist
Integralist / Imager.js
Last active December 21, 2015 01:38
Imager.js (as of 14th August 2013)
(function (window, document) {
'use strict';
var $, Imager;
window.requestAnimationFrame =
window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||