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 | |
/** | |
* @file | |
* Example of how to add an autocomplete path to a textfield and convert it to | |
* the user ID before saving it to a variable via `system_settings_form()`. | |
*/ | |
/** | |
* Admin settings form. |
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
### | |
# BEGIN MOBILE REDIRECTS | |
### | |
# If the skipMobileDetection cookie is set, and we're on the mobile domain, | |
# return to the normal domain. Do this only for SSL as Varnish will handle | |
# for port 80. | |
RewriteCond %{HTTP_COOKIE} skipmobiledetection [NC] | |
RewriteCond %{HTTP_HOST} ^m\. [NC] | |
RewriteCond %{SERVER_PORT} =443 |
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
#!/bin/bash | |
find . -maxdepth 2 -type d -name public -exec drush -r /var/www/{} sql-connect \; |
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 | |
// Get all the node types that can post into groups, i.e. all types that would | |
// have og_access entries, and add to the content_access_settings variable. | |
$settings = variable_get('content_access_settings', array()); | |
foreach (node_get_types() as $type_name => $type) { | |
if (!og_is_omitted_type($type_name)) { | |
if (!isset($settings['view'][$type_name])) { |
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 | |
/** | |
* Return all existing node IDs from a given FeedsImportBatch object. | |
* | |
* @param $processor | |
* Instance of FeedsNodeProcessor. | |
* @param $source | |
* Instance of FeedsSource. | |
* |
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
#!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
sub automatic_choice { | |
my ($n, $i, $j, $c, $u, $d, $t); | |
my ($win, $guess, $switch); | |
print STDERR "How many doors? [ > 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
#!/bin/bash | |
# | |
# this script should not be run directly, | |
# instead you need to source it from your .bashrc, | |
# by adding this line: | |
# . PATH_TO_SCRIPT/goto_repo.sh | |
function repo() { | |
reponame=$1 | |
basedir="$HOME/Sites/$reponame" |
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
alias now='/bin/date +%s' | |
# Convert a timestamp | |
unixtime() { | |
php -r 'if (isset($argv[1]) && is_numeric($argv[1])) print date(DATE_RSS, $argv[1]) . "\n";' $1 | |
} | |
# Local VM config | |
export localvmname="Debian32" |
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 | |
/** | |
* @file | |
* Find out which words are most commonly used in song lyrics. | |
*/ | |
$wordcounts = array(); | |
$lines = file('album/song.txt'); | |
foreach ($lines as $line_num => $line) { |
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 | |
if ($order_id = db_result(db_query("SELECT order_id FROM {fundraiser_webform_order} WHERE sid = %d", $_GET['sid']))) { | |
$order = uc_order_load($order_id); | |
$order_total = isset($order->order_total) ? $order->order_total : 0; | |
} | |
?> |