Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Rainbow justinrainbow

  • Phoenix, AZ
View GitHub Profile
View apc.rb
require 'formula'
class Apc <Formula
url 'http://pecl.php.net/get/APC-3.1.4.tgz'
homepage 'http://php.net/manual/en/book.apc.php'
md5 ''
version '3.1.4'
def install
Dir.chdir "APC-#{version}" do
View php.rb
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
View gist:736836
<?php
// Application/HelloBundle/Author.php
class Author
{
/**
* @validation:NotBlank()
* @validation:MinLength(3)
*/
private $firstName;
View gist:790564
<?php
// this is valid php
$foo = $bar ?: 'baz';
// it's the equivalent to
$foo = isset($bar) && $bar ? $bar : 'baz';
@justinrainbow
justinrainbow / php.rb
Created Jan 31, 2011
homebrew formula for installing php 5.3.3
View php.rb
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.3.tar.gz/from/this/mirror'
homepage 'http://php.net/'
md5 '5adf1a537895c2ec933fddd48e78d8a2'
View .gitconfig
[url "git@github.com:"]
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
@justinrainbow
justinrainbow / js_method.php
Created Mar 3, 2011
an effort to make using the ui js modules easier {$yui->onAvailable("#myselector")->plug("flashpanel", $cfg)}
View js_method.php
<?php
class YuiMethod
{
protected $selector;
protected $helpers;
protected $code;
public function __construct($selector, $helper = null)
{
@justinrainbow
justinrainbow / fix-smarty.php
Created Apr 8, 2011
Runs through a bunch of *.tpl files to update syntax from Smarty2 to Smarty3 -- no whitespace around tags
View fix-smarty.php
<?php
$dir = new RecursiveDirectoryIterator(dirname(__FILE__));
$iterator = new RecursiveIteratorIterator($dir);
$pattern = '~\{(.+?)\}~im';
$start_char = '{';
$end_char = '}';
@justinrainbow
justinrainbow / compl1.php
Created Apr 22, 2011 — forked from antirez/compl1.rb
Redis autocompletion - in php
View compl1.php
<?php
# compl1.php - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
$redis = new Redis();
$redis->connect('127.0.0.1');
# Create the completion sorted set
if (!$redis->exists('compl')) {
View gist:952472
# test for the git ps1 script
declare -f __git_ps1 >/dev/null
if (( $? ))
then
PS1='[\[\033[34m\w\033[0m]\n[\t \u]\$ '
else
PS1='[\[\033[34m\w\033[0m$(__git_ps1 " (\033[0;32m%s\033[0m)")]\n[\t \u]\$ '
fi
You can’t perform that action at this time.