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
/** | |
* Implements hook_block_info(). | |
*/ | |
function YOUR_MODULE_block_info() { | |
$blocks = array(); | |
$blocks['YOUR_BLOCK_ABC'] = array( | |
'info' => t('YOUR BLOCK NAME'), | |
); | |
return $blocks; |
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
function validate_email($email) { | |
$filtered = filter_var($email, FILTER_VALIDATE_EMAIL); | |
if ($filtered == $email) { | |
return TRUE; | |
} | |
return FALSE; | |
} |
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
https://news.google.com/news/feeds?um=1&ned=us&hl=en&q=rick+perry&output=rss |
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
/** | |
* Implements hook_preprocess_html(). | |
* Add classes to <body> tag based on taxonomy terms. | |
*/ | |
function wfm_static_preprocess_html(&$vars) { | |
$node = node_load(arg(1)); | |
if ($node && $node->type === 'page') { | |
if (count($node->field_body_classes) > 0) { | |
foreach ($node->field_body_classes[LANGUAGE_NONE] as $term) { | |
$machine_name = drupal_html_class($term['taxonomy_term']->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
/** | |
* Implements hook_preprocess_html(). | |
* Add classes to <body> tag based on metatag keywords. | |
* | |
* Previous version used hook_node_view() to make keywords accessible to | |
* this function to avoid a node_load(). However, this hook is not available | |
* on mobile due to Panels so this node_load() is necessary to work for | |
* both themes. | |
*/ | |
function hook_preprocess_html(&$vars) { |
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 | |
# | |
# Rebuild CSS with Compass for both desktop and mobile theme | |
USER_HOME=$(eval echo ~${SUDO_USER}) | |
DOCROOT="$USER_HOME/Sites/wfmcom/docroot/" | |
cd $(echo $DOCROOT/sites/all/themes/wholefoods) | |
pwd | |
THEME=$(pwd) | |
rm $(echo $THEME/css/style.css) |
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 | |
# | |
# Bonus Calculator for WFM quarterly bonuses | |
read -p "What is your hourly rate? " rate | |
read -p "Is this a 12 or 16 week period? " weeks | |
read -p "What is your bonus percentage? (whole integer, not decimal) " percent | |
bonus=$(echo "$rate * 40 * $weeks * .$percent" | bc) | |
echo "Your full bonus is: $bonus" |
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
/** | |
* @file | |
* Fetch card data from mtgjson.com, write it in a format | |
* that is more easily consumed by our application. | |
*/ | |
'use strict'; | |
var http = require('http'), | |
fs = require('fs'); |
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 | |
# Sync prod down to local. | |
rsync -chavzP --stats [email protected]:/remote/path/to/root/wp-content/uploads/ /local/path/to/root/wp-content/uploads/ | |
echo "Creating MySQL dump" | |
mysqldump -P 3306 -h example.com -u username -pPASSWORD db_name > dump.sql | |
echo "Importing MySQL dump" | |
mysql -u root -proot -h 127.0.0.1 db_name < dump.sql |
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
/** | |
* Casper.js testing test | |
*/ | |
var testSuite = { | |
config: { | |
baseUrl: 'http://www.wholefoodsmarket.com', | |
}, | |
googleTest: function(){ |