Skip to content

Instantly share code, notes, and snippets.

@fomigo
fomigo / jquery.groupedAjax.js
Created February 17, 2012 11:35 — forked from Zoramite/jquery.groupedAjax.js
jQuery ajax grouping with Deferred objects.
(function($){
var requests = {};
$(function(){
// Determine which data you need and call the getData()...
// Stubbing in some example data...
// This is a unique request and would make an ajax call
getData({
foo: 'bar'
@fomigo
fomigo / SplClassLoader.php
Created March 10, 2012 05:51 — forked from jwage/SplClassLoader.php
SplClassLoader implementation
<?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.
@fomigo
fomigo / gist:2011903
Created March 10, 2012 16:14 — forked from d33pfri3d/gist:2005383
jQuery : Ajax Deferred
$.X = function(){
var deferred = new $.Deferred();
// DO AJAX
/*
$.ajax({
// Do Ajax Call
url: '',
//Success
@fomigo
fomigo / defaultTemplateByParentTv.plugin.php
Created April 9, 2012 15:37 — forked from bfncs/defaultTemplateByParentTv.plugin.php
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
@fomigo
fomigo / jquery.defaultvalues.js
Created April 9, 2012 15:39 — forked from bfncs/jquery.defaultvalues.js
jQuery Plugin: Default form values from labels
/* DefaultValues v0.1 - Form input default values from labels
* by Marc Loehe
* http://marcloehe.de
*/
(function ($) {
$.fn.DefaultValues = function() {
return this.each(function() {
var form = $(this);
$(this).find('input[type=text], textarea').each(function() {
@fomigo
fomigo / test-speed.php
Created April 14, 2012 07:02 — forked from opengeek/test-speed.php
Simple benchmark for iterative MODX Chunk parsing
<?php
include 'config.core.php';
include MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$tstart = $modx->getMicroTime();
@fomigo
fomigo / PSR-0-final-proposal.md
Created May 22, 2012 06:14 — forked from Thinkscape/PSR-0-final-proposal.md
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
@fomigo
fomigo / installer.sh
Created June 23, 2012 13:16 — forked from pjkelly/installer.sh
Installing PHPUnit via Pear on Ubuntu Lucid
# Uninstall any pre-existing packaged
# versions of phpunit
sudo apt-get remove phpunit
# Install pear via apt-get
sudo apt-get install php-pear
# Update existing pear channels
sudo pear channel-update pear.php.net
@fomigo
fomigo / SplClassLoader.php
Created July 5, 2012 06:03 — forked from wilmoore/SplClassLoader.php
PHP 5.3 Namespace Autoloader
<?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.
<?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.