Skip to content

Instantly share code, notes, and snippets.

@fomigo
fomigo / paging.php
Created August 20, 2014 08:36 — forked from sloped/paging.php
<?php
//Use this function to create pagingation links that are styleable with Twitter Bootstrap
function paging() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
@fomigo
fomigo / wp-query-ref.php
Last active August 29, 2015 14:26 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@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 / 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.