Skip to content

Instantly share code, notes, and snippets.

Here's the base sanitizer:

<?php

namespace FooProject\Internal\Sanitizers;

abstract class BaseSanitizer
{
    /**

My Validation Base Class

I was asked how I deal with validation / create and update validation rulesets. Well here is one method I have used. Don't be afraid to build on top of what the framework has already given you. In my projects I use a base class for almost anything. You never know when you want your classes to inherit some common functionality. My BaseValidator actually has some pretty useful methods and properties in it.

<?php

namespace FooProject\Internal\Validators;

use FooProject\Internal\Sanitizers\BaseSanitizer;
@jesseobrien
jesseobrien / debug.php
Last active January 3, 2016 12:28
Debug halp file
<?php
class Debug {
/**
* Return the file and line called.
*/
public static function whoCalledMe()
{
$backtrace = debug_backtrace();
@jesseobrien
jesseobrien / query.php
Created January 16, 2014 15:49
Illuminate log every database query.
<?php
$this->app->events->listen('illuminate.query', function($query)
{
$this->app->log->warning($query);
});
@jesseobrien
jesseobrien / main.go
Created January 16, 2014 04:26
Go composer.json unmarshalling.
package main
import (
"encoding/json"
"fmt"
)
// https://github.com/composer/composer/blob/master/res/composer-schema.json
// http://getcomposer.org/doc/04-schema.md#repositories
// IGNORE THIS -- MIGHT NOT BE USED
#!/usr/bin/env bash
# Upgrade Base Packages
sudo apt-get update
sudo apt-get upgrade -y
# Install Web Packages
sudo apt-get install -y build-essential dkms re2c apache2 php5 php5-dev php-pear php5-xdebug php5-apcu php5-json php5-sqlite \
php5-mysql php5-pgsql php5-gd curl php5-curl memcached php5-memcached libmcrypt4 php5-mcrypt postgresql redis-server beanstalkd \
openssh-server git vim python2.7-dev
@jesseobrien
jesseobrien / gist:8268062
Last active January 2, 2016 07:09
Quick Tmuxinator config
# ~/.tmuxinator/myproject.yml
name: myproject
root: ~/projects/example.com/
windows:
- editor:
layout: main-vertical
panes:
- vim
- guard
@jesseobrien
jesseobrien / Dependencies
Last active January 1, 2016 21:39
Arch linux HHVM PKGBUILD and patch file for 2.4.2.
wget both PKGBUILD and hhvm-2.4.2.patch
Install these from the AUR
`packer -S oniguruma libdwarf`
makepkg -s
@jesseobrien
jesseobrien / hhvm.conf
Last active September 30, 2025 01:17
HHVM Server
Server {
Port = 8080
SourceRoot = /path/to/public
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
@jesseobrien
jesseobrien / gist:7418983
Last active December 4, 2024 10:13
Bind parameters into the SQL query for Laravel ORM
<?php
class MyModel extends Eloquent {
public function getSql()
{
$builder = $this->getBuilder();
$sql = $builder->toSql();
foreach($builder->getBindings() as $binding)
{