This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get URI parameter. | |
* | |
* @param string $str | |
* Example to use $str urldecode(drupal_get_destination()). | |
* @return array | |
*/ | |
function _more_node_buttons_get_params($str) { | |
$chunks = explode("?", $str); | |
$params = explode("&", $chunks[1]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_url_outbound_alter() - from URL Alter module | |
*/ | |
function YOURMODULE_url_outbound_alter(&$path, &$options, $original_path) { | |
// Rewrite paths for rices4peru.com | |
if ($_SERVER['HTTP_HOST'] == "www.rices4peru.com") { | |
$options['absolute'] = TRUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ServicesContext implements ArrayAccess { | |
protected $handlers; | |
protected $namespaces; | |
private $values = array(); | |
function __construct($handlers = array(), $namespaces = array()) { | |
$this->handlers = $handlers; | |
$this->namespaces = $namespaces; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_url_outbound_alter() - from URL Alter module | |
*/ | |
function YOURMODULE_url_outbound_alter(&$path, &$options, $original_path) { | |
// Rewrite paths for rices4peru.com | |
if ($_SERVER['HTTP_HOST'] == "www.rices4peru.com") { | |
$options['absolute'] = TRUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html | |
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json'; | |
$file= file_get_contents($url); | |
$json = json_decode($file); | |
$rows = $json->{'feed'}->{'entry'}; | |
foreach($rows as $row) { | |
echo '<p>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: io github <query> [language] | |
io github django | |
io github coffeescript | |
To limit search results to a certain language: | |
io github django python | |
To see debug info: | |
io --debug github django |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery | |
set nocompatible | |
set autoindent | |
set tabstop=2 | |
set showmatch | |
set vb t_vb= | |
set ruler | |
set nohls | |
set incsearch | |
syntax on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// drupal log parser w/ node.js | |
// takes a filtered syslog file | |
// run as node `drupal-syslog-parser.js LOGPATH` | |
// [install dependencies (lazy,underscore) first with `npm install ___`] | |
var lazy = require('lazy') | |
, fs = require('fs') | |
, path = require('path') | |
, _ = require('underscore'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_file_url_alter(). | |
* | |
* Make all URLs be protocol relative. | |
* Note: protocol relatice URLs will cause IE7/8 to download stylesheets twice. | |
* @see http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-download/ | |
*/ | |
function custom_file_url_alter(&$url) { |
OlderNewer