Skip to content

Instantly share code, notes, and snippets.

View manewitz's full-sized avatar
👾

Mike Manewitz manewitz

👾
View GitHub Profile
@manewitz
manewitz / progress_bar.rb
Created July 24, 2012 19:42
Formatador Progress Bar Example
# This is an example of using the progress bar feature of Formatador.
require "rubygems"
require "formatador"
require "rake"
current = 0
total = 100
# get terminal width
@manewitz
manewitz / token.rb
Created May 26, 2015 18:08
Ruby String Token Generator
# Extracted library from a deprecated app
class Token
PREFIXES = ['ab', 'ac', 'acr', 'acl', 'ad', 'adr', 'ah', 'ar', 'aw', 'ay', 'br', 'bl', 'cl', 'cr', 'ch', 'dr', 'dw', 'en', 'ey', 'in', 'im', 'iy', 'oy', 'och', 'on', 'qu', 'sl', 'sh', 'sw', 'tr', 'th', 'thr', 'un', 'st', 'str', 'kn']
DIPTHONGS = ['ae', 'au', 'ea','ou','ei','ie','ia','ee','oo','eo','io']
CONSONANT_PAIRS = ['bb', 'bl', 'br', 'ck', 'cr', 'ch', 'dd', 'dr', 'gh', 'gr', 'gn', 'gg', 'lb', 'ld', 'lk', 'lp', 'mb', 'mm', 'nc', 'nch', 'nd', 'ng', 'nn', 'nt', 'pp', 'pl', 'pr', 'rr', 'rch', 'rs', 'rsh', 'rt', 'sh', 'th', 'tt', 'st', 'str']
POSTFIXES = ['able', 'act', 'am', 'ams', 'ect', 'ed', 'edge', 'en', 'er', 'ful', 'ia', 'ier', 'ies', 'illy', 'im', 'ing', 'ium', 'is', 'less', 'or', 'up', 'ups', 'y', 'igle', 'ogle', 'agle', 'ist', 'est']
VOWELS = ['a', 'e', 'i', 'o', 'u']
CONSONANTS = ('a'..'z').to_a - VOWELS