Skip to content

Instantly share code, notes, and snippets.

View wilmoore's full-sized avatar

Wil (₩) Moore III wilmoore

View GitHub Profile
@wilmoore
wilmoore / symfony-console-program-options-arguments.php
Created January 5, 2011 21:06
Symfony Console -- injecting additional top-level options/arguments at the program level
/**
* php job-queue.php --environment=local [command|namespace:command]
* php job-queue.php --environment=local job:monitor
*
* NOTE:
* looks like you can actually put the option anywhere...the folllowing works just fine
* > php job-queue.php job:monitor --environment=local
*/
// inject custom required argument (execution halts if program is called without this argument)
@wilmoore
wilmoore / zf2-mvc-restful-trait.php
Created January 17, 2011 17:44
Using Traits instead of inheritance to build a Restful Dispatcher in ZF2 MVC
// REF: http://framework.zend.com/wiki/display/ZFDEV2/Proposal+for+MVC+Interfaces
trait RestDispatcher
{
public function dispatch(Request $request, Response $response = null)
{
if (!$request instanceof HttpRequest) {
throw new DomainException('REST expects HTTP requests');
}
@bitlyfied
bitlyfied / curry.php
Created January 30, 2011 19:31
Experiment with functional patterns in PHP
<?php
function curry() {
$curryArgs = func_get_args();
return function() use ($curryArgs){
$function = array_shift($curryArgs);
$mergedArgs = array_merge($curryArgs, func_get_args());
return call_user_func_array($function, $mergedArgs);
};
}
> On Feb 1, 2011, at 6:10 AM, Ed Randall wrote:
>
> As I see it we have two options.
> 1) Do nothing, continue with the Oracle Hudson branch.
> 2) Put in a bit of effort and go with Jenkins.
>
> The first option will be a lot easier to "sell" to my management.
>
> One problem that we've encountered frequently in the past with Hudson
> is stability after upgrades.
@wilmoore
wilmoore / log.js
Created February 1, 2011 22:20
JavaScript Snippets for new projects
// Slightly smaller version of Paul's lightweight log wrapper -- Thanks Paul Irish
// http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog
window.log=function(){log.history=log.history||[];log.history.push(arguments);this.console&&console.log(Array.prototype.slice.call(arguments))};
@wilmoore
wilmoore / object-create.js
Created February 9, 2011 21:13
JavaScript Object Create Function
if (typeof Object.create !== 'function') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
@wilmoore
wilmoore / sass_and_less_compared.markdown
Created February 10, 2011 06:17 — forked from chriseppstein/sass_and_less_compared.markdown
Sass/Less Comparison (updated 2011-02-09) -- thanks to chriseppstein for starting this

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For less, I'm using the ruby version because this is what they suggest on the website. The javascript version may be different.

Variables

@chrisjacob
chrisjacob / README.md
Created February 18, 2011 03:44
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');
@ded
ded / domready.js
Created February 24, 2011 08:46
Smallest x-browser DOM Ready, ever
function r(f){/in/(document.readyState)?setTimeout(r,9,f):f()}