Skip to content

Instantly share code, notes, and snippets.

@carlynorama
carlynorama / gist:1326675
Created October 31, 2011 01:05
creating a sym link for using my regular git folder with MAMP install
# go to the folder where the link should be from
cd /Applications/MAMP/htdocs/
# make the link, -s means symbolic
# format is ln -s [source] [target]
# using the period mean "use the same name"
ln -s /Users/[USERNAME]/Documents/GitHub/CRASHSpace/drupal_crashspace_dev/drupal_crashspace_dev .
# then see it listed a reference
ls -l
@carlynorama
carlynorama / gist:1326679
Created October 31, 2011 01:11
gitignore for mac os drupal repository
#for crashspace drupal project.
#drupal_crashspace_dev is the name of the directory where the web files are.
# Ignore MacOS Folder Attributes files
.DS_Store
# Ignore configuration files that may contain sensitive information.
#drupal_crashspace_dev/sites/*/settings*.php
# Ignore paths that contain user-generated content.
@carlynorama
carlynorama / drush_MAMP_setup
Created October 31, 2011 05:31
install drush into MAMP setup
#go to the folder
cd /Applications/MAMP/bin
#get drush off on the internet (mac has curl not wget, make sure it is the latest drush)
curl -O http://ftp.drupal.org/files/projects/drush-7.x-4.5.tar.gz
#decompress
tar -zxvf drush-7.x-4.5.tar.gz
#delete tar ball
rm drush-7.x-4.5.tar.gz
#user executable
chmod u+x drush/drush
@carlynorama
carlynorama / modules
Created November 7, 2011 02:08
drush commands to download modules up for debate on the crash space dev site
---- Before Chapter 4
drush dl admin_menu
drush dl advanced_help
drush dl backup_migrate
drush dl calendar
drush dl captcha
drush dl ctools
drush dl date
drush dl devel
@carlynorama
carlynorama / drupal shell install
Created November 9, 2011 23:12
Install of Clean Drupal Sandbox Site
#because my copy of drupal 7.9 is in the Downloads folder
cd $HOME/Downloads
#if you haven't gotten it already
#curl -O http://ftp.drupal.org/files/projects/drupal-7.9.tar.gz
#untar to the right place
tar -C $HOME/Documents/GitHub/CRASHSpace/SandboxDrupalSite/ -xjvf drupal-7.9.tar.gz
#go to that place
@carlynorama
carlynorama / functions
Created November 14, 2011 17:54
stdClass Object into flat array
//bust the objects down to arrays
function objectToArray($result)
{
$array = array();
foreach ($result as $key=>$value) {
if (is_object($value)) {
$array[$key]=objectToArray($value);
}
elseif (is_array($value)) {
$array[$key]=objectToArray($value);
@carlynorama
carlynorama / functions snippet
Created November 14, 2011 18:04
Wordpress: SQL Query to WP_Query Educational Fail (post__in can bite me.)
//These are in the Functions.php file
//gist-1364599
function objectToArray($result)
{
$array = array();
foreach ($result as $key=>$value) {
if (is_object($value)) {
$array[$key]=objectToArray($value);
}
@carlynorama
carlynorama / gist:1374248
Created November 17, 2011 19:45
Style sheet change to move header image above menu in Twenty Eleven child theme
#access {
position: absolute;
top: 180px;
}
#branding img {
position: relative;
margin-top: 50px;
}
@carlynorama
carlynorama / gist:1374249
Created November 17, 2011 19:45
Style sheet change to move header image above menu in Twenty Eleven child theme
#access {
position: absolute;
top: 180px;
}
#branding img {
position: relative;
margin-top: 50px;
}
@carlynorama
carlynorama / header_excerpt.php
Created November 17, 2011 19:56
excerpt from wordpress header.php to have it get a category based header image
<?PHP
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
//--- Added to have blog category page headings
elseif( is_category() ) :