Skip to content

Instantly share code, notes, and snippets.

View sparksp's full-sized avatar
🏠
Working from home

Phill Sparks sparksp

🏠
Working from home
View GitHub Profile
@sparksp
sparksp / http.js.diff
Created April 29, 2010 10:52
NodeJS: Collect Headers on the Response Object (issue 129)
Headers should be stored as an object, arrays used for multiple values; e.g.,
var headers =
{ 'Content-Type': 'text/html'
, 'Content-Length': 4096
, 'Set-Cookie':
[ 'hits=1; Path=/'
, 'foo=; Max-Age=-1; Path=/'
]
};
diff --git a/configure b/configure
index 7267f64..2273bb8 100755
--- a/configure
+++ b/configure
@@ -7,14 +7,12 @@ if [ ! -z "`echo $CC | grep ccache`" ]; then
exit 1
fi
-CUR_DIR=$PWD
-
@sparksp
sparksp / Laravel\Form::__callStatic.php
Created November 29, 2011 08:54
Laravel\Form magic method to support open to routes.
<?php namespace Laravel;
class Form {
/**
* Magic method to handle opening of forms to named routes
*
* <code>
* // Open a form to the "login" named route
* Form::open_to_login();
@sparksp
sparksp / gist:1447157
Created December 8, 2011 14:43
Determine whether the given URL is handled by the current request
<?php
/**
* Determine whether the given URL is handled by the current request
*
* @param string $url
* @param bool $https
* @return bool
*/
function isActiveURL($url, $https = false)
@sparksp
sparksp / libraries-file.php
Created December 13, 2011 15:07
Extended File for Laravel
<?php
/**
* File
*
* Note: Remember to remove the "File" alias in APP_DIR/config/application.php
*
* @author Phill Sparks <me@phills.me.uk>
*/
class File extends Laravel\File {
@sparksp
sparksp / models-snip.php
Created December 22, 2011 11:53
[Laravel] Snip Example
<?php
class Snip extends Eloquent {
public static $timestamps = true;
static function install()
{
DB::query('CREATE TABLE IF NOT EXISTS snips (
id INTEGER PRIMARY KEY ASC, slug TEXT UNIQUE,
@sparksp
sparksp / route-parameters.diff
Created January 12, 2012 17:01
Laravel: Extract route parameters based on the regex
diff --git a/laravel/routing/router.php b/laravel/routing/router.php
index ad62ea1..0154441 100644
--- a/laravel/routing/router.php
+++ b/laravel/routing/router.php
@@ -157,9 +157,11 @@ class Router {
{
foreach (explode(', ', $keys) as $key)
{
- if (preg_match('#^'.$this->wildcards($key).'$#', $destination))
+ if (preg_match('#^'.$this->wildcards($key).'$#', $destination, $parameters))
@sparksp
sparksp / routes-test.php
Created January 20, 2012 15:14
Laravel 2.2b1 WSOD Test
<?php
Router::route('GET /test', function()
{
return View::make('test');
});
@sparksp
sparksp / womble.sql
Created January 28, 2012 00:07
Womble Schema
CREATE TABLE "attendee" (
"id" INTEGER PRIMARY KEY,
"group_id" INTEGER,
"name" TEXT,
"saturday" TEXT,
"sunday" TEXT,
"extra" TEXT
);
@sparksp
sparksp / apigen.neon
Created February 4, 2012 09:19
Laravel ApiGen Config
title: Laravel 3.0
source: laravel
destination: api
main: Laravel
php: no
exclude:
- *stub.php