Skip to content

Instantly share code, notes, and snippets.

View astroud's full-sized avatar

Aaron Stroud astroud

View GitHub Profile
@astroud
astroud / DigitalColor-Meter-fix.scpt
Created January 31, 2012 21:34
Lion's DigitalColor Meter defaults to displaying color values as decimals instead of hex. Loading DigitalColor Meter via this AppleScript remedies that.
-- Mountain Lion (10.8) fixed this oversight. The DigitalColor Meter now remembers it's settings on exit.
-- DigitalColor Meter defaults to displaying color values in decimal and will not remember hexidecimal preferences on close. So this script launches the app and tells it to display values in hex. It is meant to be launched via QuickSilver or a launcher.
-- Checks to see if System Preferences > Universal Access > Enable access for assistive devices is checked
-- This option is required for "System Events" to use the keystroke and key code commands.
-- If it is not checked, your password is required to make the change
tell application "System Events" to if not UI elements enabled then
set UI elements enabled to true
@astroud
astroud / volumeDown.scpt
Created December 19, 2011 20:12
Precise volume control in Lion
# Mountain Lion (10.8) restored granular volume controls. Hold Shift + Option while changing volume with the keyboard.
# Apple broke fine volume control in Lion (10.7)
# I use Quicksilver triggers to call this script and it's twin that pushes the volume up
set currentVolume to output volume of (get volume settings)
set volume output volume (currentVolume - 1)
do shell script "afplay /System/Library/LoginPlugins/BezelServices.loginPlugin/Contents/Resources/volume.aiff"
@astroud
astroud / fuzzy-time.rb
Created December 18, 2011 00:05
Fuzzy-Time is a new method for Ruby's Time class that presents the time in a more human-friendly format. Inspired by Objectpark's FuzzyClock.
class Time
def fuzzy
# Converts 24 hour format to 12 hours
self.hour >= 12 ? hour_num = self.hour - 12 : hour_num = self.hour
min = self.min
case hour_num # Converting the current hour to a string
when 0 then hour = "twelve"
when 1 then hour = "one"
when 2 then hour = "two"
@astroud
astroud / morse_code.rb
Created December 13, 2011 01:33
More first grade fun learning Ruby
# Inspired by https://gist.github.com/1172097
alphabet = Hash[
:a => "beep. beeeeep.",
:b => "beeeeep. beep. beep. beep.",
:c => "beeeeep. beep. beeeeep. beep.",
:d => "beeeeep. beep. beep.",
:e => "beep.",
:f => "beep. beep. beeeeep. beep.",
:g => "beeeeep. beeeeep. beep.",