Skip to content

Instantly share code, notes, and snippets.

Andy Herrman aherrman

Block or report user

Report or block aherrman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:563855
# Echoes the name of the current screen, if any
function getScreenName {
if [ ${STY:-""} == "" ]; then
screen_name="(`echo "${STY}" | sed 's/^[^\.]*\.//'`)"
echo $screen_name
aherrman / format_css.rb
Created Jul 30, 2010
ruby script to beautify some compressed css. Based on script by floatless on stackoverflow:
View format_css.rb
#Formats CSS
input, output = ARGV
if input == nil or output == nil
puts "Syntax: #{$0} [input] [output]"
package testsupport
import flexunit.framework.Assert;
/** Helper class for asserting that certain events occur and others don't */
public class EventChecker {
private var _source:IEventDispatcher;
View toggleWireless.ps1
$devid = "*DEV_4236"
$status = devcon status $devid | Select-String "running"
if($status -eq $null)
write-host "Enabling wireless"
devcon enable $devid
aherrman / powershellHere.reg
Created Jan 29, 2010
Registry file for adding a "powershell here" entry to directory right-click menus
View powershellHere.reg
Windows Registry Editor Version 5.00
@="PowerShell Here"
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
aherrman / cygwinHere.reg
Created Jan 29, 2010
Adds entry to directory right-click menu to open a cygwin terminal (mintty) at that directory
View cygwinHere.reg
Windows Registry Editor Version 5.00
@="Open Cygwin Zsh Here"
@="c:\\cygwin\\bin\\bash.exe --login -c \"cd \\\"`cygpath -u '%L'`\\\";mintty&\""
aherrman / sorted_queue.rb
Created Jan 24, 2010
Sorted queue built on top of an RB tree
View sorted_queue.rb
require 'rbtree'
# A queue that keeps its elements sorted based on the <=> operator.
# Requires the rbtree gem
class SortedQueue
include Enumerable
def initialize(ary=[])
@queue =
View gist:259765
# By hand:
def test_valid_suit_transition_clubs_diamonds
c1 = Card.get 10, :clubs
c2 = Card.get 9, :diamonds
assert SolitaireStack.are_cards_sequential?(c1, c2)
def test_valid_suit_transition_clubs_hearts
c1 = Card.get 10, :clubs
aherrman / gist:253634
Created Dec 10, 2009
First attempt at ruby koans' Greed score calculator
View gist:253634
def score(dice)
count_dice_types(dice).each_pair.inject(0) { |score, pair|
value, count = pair
score + score_dice_value(value, count)
def score_dice_value(value, count)
return 0 if count == 0
return tripple_score(value) + score_dice_value(value, count - 3) if count > 2
View gist:236264
resizeDragger = new BoundedDragResizer(this, resizeHandle,
BoundedDragResizer.rangedCheckSizeFactory(new Dimensions(50, 20)));
* Factory that returns a checkSize() implementation that bounds the window
* to be within some min and max size. No validation is done on the min
* and max sizes.
You can’t perform that action at this time.