Skip to content

Instantly share code, notes, and snippets.

View woods's full-sized avatar

Scott Woods woods

View GitHub Profile
@woods
woods / git-bump-version
Last active September 27, 2016 10:08
A script to bump a project's version number in git.
#!/usr/bin/env ruby
# Bump the version of the current git project
#
# Installation instructions: copy to /usr/local/bin/git-bump-version and set
# permissions to 0755.
#
# Author: Scott Woods <scott@westarete.com>
# Ref: https://gist.github.com/woods/7424599
require 'rubygems'
@woods
woods / aliases.sh
Created October 30, 2013 17:39
Helpful aliases for git and github.
# Use the "hub" wrapper for git (https://github.com/defunkt/hub)
eval "$(hub alias -s)"
# Enable autocomplete for built in git functions
source ~/.git-completion.sh
# git aliases. Add new ones to the bottom of ~/.git-completion.bash to enable
# autocomplete.
alias ga='git add'
alias gap='git add -p'
@woods
woods / update_ip_address.sh
Last active January 9, 2019 20:14
A cron script to periodically update a DNS record in DNSimple for a dynamic IP address.
#!/bin/bash
#
# When a machine is on a dynamic IP address cable modem, we use this script to
# periodically update DNS with the current record.
#
# Keep the contents of this file secret, since it contains the domain's API
# key. The ID of the record to be updated by hovering over it in DNSimple's
# web interface.
IP_ADDRESS="`curl -s http://icanhazip.com/`"
@woods
woods / update_ip_address.sh
Created August 26, 2013 15:41
Example script to set a dynamic record in DNSimple based on the current cable modem address. This can be run in /etc/cron.hourly.
#!/bin/bash
#
# Since paig is on a dynamic IP address cable modem, we use this script to
# periodically update DNS with the current record. In this case, we're using
# the hostname paig.2surfers.com.
#
# Keep the contents of this file secret, since it contains the domain's API
# key. The ID of the record to be updated by hovering over it in DNSimple's
# web interface.
@woods
woods / clean_up_old_releases.rb
Last active December 21, 2015 14:58
This script will clean out old capistrano releases from a set of subdirectories, but will keep a minimum number. It's designed to be run as a cron job.
#!/usr/bin/env ruby
# This script will clean out old capistrano releases from a set of
# subdirectories, but will keep a minimum number. It's designed to be run as
# a cron job.
#
# (c) Copyright 2008 West Arete Computing, Inc.
require 'date'
require 'fileutils'
@woods
woods / gist:6258842
Created August 17, 2013 21:48
Ruby exception hierarchy
Exception
NoMemoryError
ScriptError
LoadError
NotImplementedError
SyntaxError
SignalException
Interrupt
StandardError
ArgumentError
@woods
woods / en.yml
Created August 5, 2013 20:29
An example of how to specify attribute-to-English mappings for custom objects to pass to form_for. This file shows the mapping for a "payment" object. Note that it does not have to be an ActiveRecord.
en:
helpers:
label:
payment:
first_name: First Name
last_name: Last Name
email: Email
company: Company
card_number: Credit Card Number
card_expiration_date: Expiration Date
@woods
woods / git_aliases.sh
Created August 5, 2013 15:15
West Arete's git / bash setup.
# git aliases. Add new ones to the bottom of ~/.git-completion.bash to enable
# autocomplete.
alias ga='git add'
alias gap='git add -p'
alias gau='git add -u'
alias gb='git branch'
alias gc='git commit -v'
alias gca='git commit -a -v'
alias gco='git checkout'
alias gd='git diff'
<div id="social-media-icons">
<a href="Facebook.com/runthenightltd" target="_blank"><img src="http://niftyweb.cdbaby.netdna-cdn.com/rkc-social-set-1/facebook.png" align="left" border="0"></a><a href="Twitter.com/runthenightltd" target="_blank"><img src="http://niftyweb.cdbaby.netdna-cdn.com/rkc-social-set-1/twitter.png" border="0" align="left"></a><a href="YouTube.com/runthenighttv" target="_blank"><img src="http://niftyweb.cdbaby.netdna-cdn.com/rkc-social-set-1/youtube.png" border="0" align="left"></a>
<br>
</div>
@woods
woods / helper.rb
Created May 30, 2013 03:16
Helpers for embedding or displaying links to a Google map
module GoogleMapsHelper
# Returns a URL to use in an iframe for embedding a Google map
# Reference: http://asnsblues.blogspot.com/2011/11/google-maps-query-string-parameters.html
def google_maps_embed_url(address)
"#{google_maps_url(address)}&output=embed"
end
# Returns a URL to use for linking to a Google map
# Reference: http://asnsblues.blogspot.com/2011/11/google-maps-query-string-parameters.html