Skip to content

Instantly share code, notes, and snippets.

@codenamegary
codenamegary / laravel-autoconfig.php
Created March 14, 2012 01:37
Auto-Config function for laravel's index.php, sets 'LARAVEL_ENV' based on the active page URL
<?php
/*
| Set a 'urls' (note the plural) in your application.php config files.
| Example application/config/application.php for PRODUCTION:
|
| return array(
| 'urls' => array(
| 'http://productionsite.com',
| 'http://www.productionsite.com',
@codenamegary
codenamegary / classloader.php
Created March 22, 2012 03:15
PSR-0 Compatible regex class loader
<?php
echo "<PRE>";
$regex = "^\\\([a-zA-Z_]+){1}\\\([a-zA-Z_]+){1}\\\?([a-zA-Z]+)?_?([a-zA-Z]+)?_?([a-zA-Z]+)?_?([a-zA-Z]+)?$";
echo "Regex: " . $regex . "\r\n";
// Change Class name to test accordingly for whatever your class name is
if (isset($_GET['classname'])) { $className = $_GET['classname']; } else { $className = "\\Vendor\\Namespace\\Class"; }
echo "Class Name: " . $className . "\r\n";
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
75.126.19.144/28
75.126.23.16/28
173.193.185.248/29
184.173.69.128/28
50.22.39.192/28
50.97.157.0/26
75.126.59.16/28
108.168.247.192/27
173.193.171.136/29
173.193.179.248/29
@codenamegary
codenamegary / gist:7012970
Created October 16, 2013 19:01
Fork this gist, add 1 line, post back to Reddit.
<?php
$velocities = array("turtle", "donkey", "rabbit");
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'2' => array(
'name' => 'Bar',
'velocity' => $velocities[rand(0,2)]),
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'2' => array(
'name' => 'Bar',
'velocity' => $velocities[rand(0,2)]),
@codenamegary
codenamegary / gist:7013392
Last active December 25, 2015 17:29 — forked from s3gfau1t/gist:7013352
Added actions and actionsFunc
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'actions' => array(),
'2' => array(
'name' => 'Bar',
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)],
'actions' => array(),
),
'2' => array(
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)],
'actions' => array(),
),
'2' => array(