Skip to content

Instantly share code, notes, and snippets.

@augustohp
augustohp / Doctrine.ini
Created February 1, 2012 18:15
Doctrine.ini configuration to use with Respect\Config
; Configurations
db_host = 'localhost'
db_user = 'zend'
db_passwd = ''
db_name = 'test'
db_driver = 'mysql'
;db_port = 3306
;db_charset = 'utf8'
dsn = '[db_driver]:host=[db_host];dbname=[db_name]'
dsn = 'sqlite::memory:'
@dhotson
dhotson / oo.php
Created December 6, 2011 12:02
PHP Object Oriented Programming Reinvented (for PHP 5.4)
<?php
// Define the 'class' class
$class = (new Obj)
->fn('new', function() {
$newClass = (new Obj($this->methods))
->fn('new', function() {
$obj = new Obj($this->imethods);
call_user_func_array(array($obj, 'init'), func_get_args());
return $obj;
@augustohp
augustohp / cmd_osx_apc_php53.sh
Created August 7, 2011 23:56
APC installation for OSX
#!/bin/bash
#
# Downloads and install latest APC extension to OSX php (Zend Server).
# Tested under OSX 10.6.7, more feedback is appreciated.
#
# OSX is 64bit but the PHP binary in Zend Server is compiled in 32bit mode only,
# so to have APC working with Zend Server on OSX statically compiling it with default
# recommended flags and forced i386 architecture.
# I suppose that Zend Server's binary path is already into your PATH variable and it
# is used before the native PHP binary bundled with OSX.
@augustohp
augustohp / svn2git.sh
Created June 13, 2011 22:33
SVN to GIT migration shell script
#!/bin/sh
# Migrates a SVN repository to a git repository.
#
# Author: Augusto Pascutti <augusto@phpsp.org.br>
COMMAND=$0;
SVN=`which svn 2> /dev/null`;
GIT=`which git 2> /dev/null`;
READER="";
RETURN="";
@jwage
jwage / SplClassLoader.php
Last active July 28, 2026 02:27
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,