Skip to content

Instantly share code, notes, and snippets.

View stephenyeargin's full-sized avatar
:shipit:

Stephen Yeargin stephenyeargin

:shipit:
View GitHub Profile
@stephenyeargin
stephenyeargin / functions.php
Created August 26, 2011 03:26
Easy way to embed static content within WordPress posts and pages.
function get_partial($args) {
// If empty, return false
if (!isset($args['name']))
return false;
// If file exists, include it
$filename = sprintf(TEMPLATEPATH . '/assets/partials/%s.php', $args['name']);
if (file_exists($filename)):
ob_start();
@stephenyeargin
stephenyeargin / BackupMusic.sh
Created September 11, 2011 00:14
Backup of iTunes music folder to external drive using RSync
#!/usr/bin/env bash
echo "Checking to see if /Public/Shared Music/ is mounted ..."
if [[ -d /Volumes/Public/Shared\ Music/ ]]; then
echo "Begin rysync command ..."
rsync -vur --delete --exclude=*.db --exclude=*.info --exclude=.DS_Store ~/Music/iTunes/iTunes\ Music/Music/ /Volumes/Public/Shared\ Music
echo "Done!"
else
echo "ERROR! Remote drive not mounted."
fi
@stephenyeargin
stephenyeargin / UpdateCheckouts.sh
Created September 11, 2011 00:16
Update all subversion and git repositories in a projects directory
#!/bin/sh
txtgrn=$(tput setaf 2) # Green
txtylw=$(tput setaf 3) # Yellow
txtblu=$(tput setaf 4) # Blue
txtpur=$(tput setaf 5) # Purple
txtcyn=$(tput setaf 6) # Cyan
txtwht=$(tput setaf 7) # White
txtrst=$(tput sgr0) # Text reset
cd /Library/WebServer/Documents
@stephenyeargin
stephenyeargin / NightlyBackup.sh
Created September 11, 2011 00:26
Nightly backup script for databases and subversion repositories.
#!/bin/sh
# Variables
DB_HOSTNAME=yourdbhost
DB_USERNAME=yourusername
DB_PASSWORD=yourpassword
SVNREP_PATH=path/to/repo/folder
BACKUP_PATH=path/to/save/backups
# ######### Database Backup #########
@stephenyeargin
stephenyeargin / filter_hyperlink.php
Created October 17, 2011 03:24
Hyperlink filtering from a body of text (with hack to catch t.co links because I don't like RegEx at all).
@stephenyeargin
stephenyeargin / pollen.php
Created March 14, 2012 18:30
Nashville pollen cron job
<?php
// Config
define('POLLEN_THRESHOLD', 15);
define('EMAIL_RECIPIENT', 'stephen@example.com');
/*
0 to 5 Pollen Grains/cm = Slight
6 to 15 Pollen Grains/cm = Moderate
16 to 25 Pollen Grains/cm = Heavy
@stephenyeargin
stephenyeargin / google-o-meter.svg
Created June 30, 2012 01:52
SVG version of the Google-O-Meter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stephenyeargin
stephenyeargin / SVNStatus.php
Created July 31, 2012 16:23
Use terminal-notifier to post Subversion status information into OS X Mountain Lion's notification center.
<?php
/*
Requires:
terminal-notifier - A ruby gem that talks to notification center
launchd/cron - to schedule `php /path/to/SVNStatus.php` to run.
*/
// Config
$binary = '/path/to/bin/terminal-notifier';
@stephenyeargin
stephenyeargin / PaywallHop.user.js
Created August 2, 2012 00:08
Removes Paywall on select Gannet properties, namely the Tennessean.
// ==UserScript==
// @name PaywallHop
// @namespace gist.github.com/stephenyeargin/paywallhop
// @description Removes Paywall on select Gannet properties, namely the Tennessean.
// @include http://*.tennessean.com/*
// @version 1
// ==/UserScript==
// Make sure jQuery is loaded
(function(){
@stephenyeargin
stephenyeargin / echo.coffee
Created August 10, 2012 03:03
Allows hubot to repeat what is in a private message (through IRC adapter)
# Description:
# Allows hubot to repeat what is in a private message (through IRC adapter)
#
# Dependencies:
# hubot-irc
#
# Configuration:
# None
#
# Commands: