Skip to content

Instantly share code, notes, and snippets.

@robap
robap / closure_calc
Created June 26, 2010 23:50
use closure to create a calc file
closure/lib/closure/bin/calcdeps.py -i app/bootstrap.js -p closure/lib -p app/ -o script > public/js/app-calc.js
@robap
robap / closure_compile
Created June 26, 2010 23:51
use closure to create a compiled script
closure/lib/closure/bin/calcdeps.py -i app/bootstrap.js -p closure/lib -p app/ -o compiled -c closure/utils/compiler.jar > public/js/app.js
@robap
robap / routing.php
Created November 6, 2011 13:21
A routing file for use with php built in web-server
<?php
//Name this file .routing.php and place in webroot
//originally written by Ralph Schindler http://news.php.net/php.internals/53870
//If using zf, this is a convenient place to define the dev environment
define('APPLICATION_ENV', 'development');
//If the file exists or is an obvious static resource, do nothing by returning false.
//Route all other requests through index.php.
if ( preg_match('/\.(?:png|jpg|jpeg|gif|ico)$/', $_SERVER['REQUEST_URI']) ||
@robap
robap / install_non_stable_php_ubuntu.sh
Created November 6, 2011 14:14
Installing non stable php on Ubuntu
cd ~
mkdir apps
mkdir apps/php
cd apps/php
wget http://downloads.php.net/stas/php-5.4.0alpha3.tar.bz2
tar -jxvf php-5.4.0alpha3.tar.bz2
cd php-5.4.0alpha3
./configure
(For me, configure complained about missing libxml2)
sudo apt-get install libxml2-dev
@robap
robap / test_non_stable_php_install.sh
Created November 6, 2011 14:16
Test non stable php install
~/apps/php/php-5.4.0alpha3/sapi/cli/php -v
PHP 5.4.0alpha3 (cli) (built: Aug 26 2011 19:16:20)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2011 Zend Technologies
@robap
robap / run_non_stable_php_built_in_web_server.sh
Created November 6, 2011 14:17
Run non stable php built-in web server
cd (into your dev directory)
zf create project quickstart
cd quickstart/library
ln -s /usr/share/php/libzend-framework-php/Zend .
cd ..
~/apps/php/php-5.4.0alpha3/sapi/cli/php -S localhost:8000 public/index.php
@robap
robap / run_non_stable_php_built_in_web_server_with_routing.sh
Created November 6, 2011 14:19
Run non stable php built-in web server with routing
~/apps/php/php-5.4.0alpha3/sapi/cli/php -S localhost:8000 -t ./public ./public/.routing.php
@robap
robap / uuid_pecl_ubuntu_install.sh
Created November 6, 2011 14:28
Install uuid pecl exension on Ubuntu
sudo apt-get install uuid-dev
sudo pecl install uuid
@robap
robap / basic_uuid_pecl_usage.php
Created November 6, 2011 14:30
Basic uuid pecl usage
<?php
$uuid = uuid_create();
echo $uuid;
$uuid_bin = uuid_parse( $uuid );
@robap
robap / wrong_php_autoload.php
Created November 6, 2011 14:31
Easy but wrong way to set up php class autoloading
<?php
function __autoload( $class_name )
{
require_once $class_name . '.php';
}