Skip to content

Instantly share code, notes, and snippets.

View donaldallen's full-sized avatar

Donald Allen donaldallen

View GitHub Profile
@donaldallen
donaldallen / gist:9509497
Created March 12, 2014 15:44
If you keep all your websites in one directory, this is a pretty handy way to run vagrant up. $ start WebsiteFolderName
#!/bin/sh
DIRECTORY="/Users/dallen/Sites/GitHub/$1"
if [ -d "$DIRECTORY" ]; then
cd "$DIRECTORY" && vagrant up
else
echo "Directory does not exist."
fi
@donaldallen
donaldallen / gist:9378369
Created March 5, 2014 22:50
Sharing gulp projects with other devs can be pain, because you need to tell them to have node, brew, etc. installed. This script does that for them.
#!/bin/sh
if ! brew_loc="$(type -p "brew")" || [ -z "brew_loc" ]; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
else
printf "\e[0;32mBrew\e[0m already installed.\n"
fi
printf "Updating \e[0;32mBrew\e[0m...\n\n"
@donaldallen
donaldallen / gist:9281705
Created February 28, 2014 22:51
My .zshrc config.
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="cloud"
alias zshconfig="subl ~/.zshrc"
alias ohmyzsh="subl ~/.oh-my-zsh"
alias mk=popd
alias ls="pwd; ls --color"
gulp.task('watch', function() {
server.listen(35729, function (err) {
if (err) {
return console.log(err)
};
gulp.watch('assets/sass/*.scss', ['styles']);
gulp.watch('assets/js/*.js', ['scripts']);
gulp.watch('assets/source/img/*', ['images']);
@donaldallen
donaldallen / gist:8867659
Last active August 29, 2015 13:56
Add record to TrackVia
<?php
$record = array(
'First Name' => 'Donald',
'Last Name' => 'Allen',
'Email' => '[email protected]',
'Phone Number' => '(780) 429-9993',
'Organization New' => 'Top Draw',
'Title' => 'Senior Web Developer',
'City' => 'Edmonton',
<div class="chart" id="chart1"></div>
[ip4]{
"template": ip4.barChart(), // Can be changed to ip4.pieChart(), ip4.lineChart()
"parentElement": "#chart1",
"data": {
"reader": ip4.dataReader()
.data([
<!— INSERT ROWS HERE, REPLACING THIS LINE —>
@donaldallen
donaldallen / gist:8446431
Created January 15, 2014 22:56
nginx config with hhvm
server {
listen 80;
root /var/www/mywebsite.ca/public;
index index.php index.html index.htm;
server_name www.mywebsite.ca mywebsite.ca;
location ~ \.php$ {
fastcgi_keep_conn on;
@donaldallen
donaldallen / gist:8056458
Created December 20, 2013 15:36
Add the current page slug to your body class. Very handy!
<?php
add_filter('body_class', function($classes) {
global $wpdb, $post;
if (is_page()) {
if ($post->post_parent) {
$parent = end(get_post_ancestors($current_page_id));
} else {
$parent = $post->ID;
}
$post_data = get_post($parent, ARRAY_A);
@donaldallen
donaldallen / gist:7844541
Last active December 28, 2017 10:34
WordPress enqueue scripts with mobile detect.
<?php
add_action('wp_enqueue_scripts', function() {
if ( ! is_admin()) {
// Get rid of the default jQuery
wp_deregister_script('jquery');
// For non-mobile devices
if ( ! $wp_is_mobile()) {
wp_register_script('jquery-js', JS_PUBLIC_URI . 'vendor/jquery/jquery.min.js', array(), '', false);
// From this
section.divisions:not(.hero) {
padding:3em 3em;
background-color:$greyLighter;
text-align:center;
a {
display:block;
color:$greyDark;
font-size:em(14);