Skip to content

Instantly share code, notes, and snippets.

View shrop's full-sized avatar
👋

Mark Shropshire shrop

👋
View GitHub Profile
@shrop
shrop / gist:3138171
Created July 18, 2012 19:12
Script to unmount or mount a disk in OS X (Change /dev/disk1 to match the disk needed)
#!/bin/bash
DISKINFO=`diskutil info /dev/disk1s2 | grep 'Mounted: No'`
if [ -n "$DISKINFO" ] ; then
diskutil mountDisk /dev/disk1
else
diskutil unmountDisk /dev/disk1
fi
@shrop
shrop / gist:3285232
Created August 7, 2012 13:13
Sample vhost Created by VirtualHostX
<Directory "/Users/shrop/Sites/default/">
Allow From All
AllowOverride All
</Directory>
<VirtualHost *:80>
ServerName "default.site"
DocumentRoot "/Users/shrop/Sites/default"
</VirtualHost>
@shrop
shrop / gist:3331911
Created August 12, 2012 13:52
Apache redirect non-www to www
# Redirect non-www urls to www
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
@shrop
shrop / brewStack.md
Last active October 11, 2023 20:18
brewStack Docs
@shrop
shrop / entityfieldquery.php
Last active December 14, 2015 14:58
EntityFieldQuery() example to return all published articles
<?php
/**
* @file
* EntityFieldQuery demo.
*/
$query = new EntityFieldQuery();
// Return all articles that are published.
$result = $query->entityCondition('entity_type', 'node')
@shrop
shrop / gist:5323628
Created April 6, 2013 00:11
DrupalCamp Charlotte MailChimp signup form embed code
<!-- Begin MailChimp Signup Form -->
<link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="http://drupalcampcharlotte.us6.list-manage1.com/subscribe/post?u=1826216c8a982e629e5128287&amp;id=e574b4e40f" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<label for="mce-EMAIL">Subscribe to our mailing list</label>
@shrop
shrop / configure-env.sh
Last active December 16, 2015 07:48
A bash script to run when you want to configure your local development environment for Drupal development
#!/bin/bash
echo "Configuring local development environment for local.site..."
# Change directory to the webroot.
cd /var/www
# Sanitize the database.
drush sql-sanitize -y
@shrop
shrop / .gitignore
Last active December 17, 2015 23:49 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# Version 2.0
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# If memcached is running, flush it.
if [ `sudo /etc/init.d/memcached status` =~ 'memcached is running' ]; then
echo ”flush_all” | nc localhost 11211
echo "memcached flushed!"
fi
@shrop
shrop / gist:5995086
Last active November 17, 2022 08:07
Improved script for highlighting git repo folders which have unstated/uncommitted files. An improvement on the script for the Hazel rule created by @tylerhall: http://clickontyler.com/blog/2013/03/hazel-and-git. This improvement checks to see if the folder is actually a git repo and if not, doesn't bother processing any further.
dirname=$1
if [ -f $dirname ]; then
dirname=`dirname $dirname`
fi
cd $dirname
if [ ! -d .git ]; then
exit 1
fi