This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def english_ordinal n | |
str = n.to_s | |
str + | |
case str | |
when /11$/, /12$/, /13$/ | |
'th' | |
when /1$/ | |
'st' | |
when /2$/ | |
'nd' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A script to execute a system command in response to filesystem changes. | |
# | |
# After the latest filesystem change, a minimum interval is allowed to pass | |
# before calling the system command. | |
# Multiple filesystem changes in quick succession are treated as a single | |
# change. | |
# | |
# Pidify is used to ensure that this script can safely be called multiple | |
# times and only one instance will ever be running. | |
# The pidify ruby file is included using require_relative because I could not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = 'segfault' | |
require 'dm-core' | |
db = DataMapper.setup(:default, "mysql://#{name}:#{name}@localhost/#{name}") | |
db.select("CREATE TABLE #{name}(id INTEGER PRIMARY KEY)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import re | |
parser = argparse.ArgumentParser(description= | |
'Create a KTouch lesson from a text file. Most white space will be stripped.') | |
parser.add_argument( | |
'input_filename', help='Name of text file to read') | |
parser.add_argument( |