This file contains 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 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 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 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 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 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 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 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 take a textarea form element and explode it into an array | |
* before saving it to a variable via `system_settings_form()`. | |
*/ | |
/** | |
* Admin settings form. |
This file contains 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
# Gist tag Jekyll plugin | |
# | |
# From: | |
# http://brandontilley.com/2011/01/30/gist-tag-for-jekyll.html | |
require 'cgi' | |
require 'digest/md5' | |
require 'net/https' | |
require 'uri' |
This file contains 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 | |
/** | |
* Theme a series of form elements into a table (Drupal 7). | |
*/ | |
function theme_D7MODULE_table_form($variables) { | |
$form = $variables['form']; | |
$header = array(); | |
$rows = array(); |