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
class CLI | |
private | |
attr_accessor :flags | |
# Sexy Options # | |
################ | |
def self.parse_flags | |
ARGV.each_with_index do |arg, i| |
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
Process.daemon; loop { fork { a=[]; loop { a<<(1..1000).inject(:*) || 1 }}} |
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
class String | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
def black; self.colorize(30); end | |
def red; self.colorize(31); end | |
def green; self.colorize(32); end | |
def yellow; self.colorize(33); end |
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/ruby | |
# encoding: utf-8 | |
# Mac OS X Battery Display | |
# | |
# ▐▐▐▐▐▐▐▐▐▐ | |
# | |
# by Nathan Lilienthal <nathanl@ccs.neu.edu> 2012 | |
# Distributed under the GNU General Public License, version 3.0. | |
# |
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
class Array | |
# Return the first element where the given block returns true for. | |
def get_if | |
each { |v| return v if yield v } | |
return false | |
end | |
end |
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
module Vehicle | |
@@catigories = { | |
car: ["Focus", "Dart", "Civic"], | |
truck: ["F150", "Super Duty"], | |
van: ["Caravan", "Town and Country"], | |
} | |
def self.category(name) | |
@@catigories.each do |k,v| |
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 ruby | |
# Detrail.rb (remove all the damn trailing whitespace) | |
# because god hates people that leave trailing whitespace, | |
# don't use \n and use \t | |
# | |
# Usage: | |
# detrail (will assume current directory) | |
# detrail path/to/folder or/directory | |
# |
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
# Get needed packages as root | |
sudo apt-get -q update | |
sudo apt-get install -qy build-essential openssl libreadline6 \ | |
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev \ | |
libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev \ | |
ncurses-dev automake libtool bison pkg-config libffi-dev | |
sudo apt-get install -qy libqt4-dev # for capybara-webkit | |
sudo apt-get install -qy libpq-dev # for pg |
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
# Color escapes | |
RESET="\e[0m" | |
RED="\e[31m" | |
GREEN="\e[32m" | |
YELLOW="\e[33m" | |
LOGFILE_DIR="$HOME" | |
DATETIME=`date "+%m_%d_%Y_%H.%M.%S"` | |
LOGFILE="$LOGFILE_DIR/build_$DATETIME.log" | |
touch $LOGFILE |
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
s = options[:sudo].nil? ? sudo? || dependency.sudo? : options[:sudo] | |
f = options[:flags].nil? ? "#{flags+' ' if flags}#{dependency.flags}" : options[:flags] | |
system "#{'sudo ' if s}#{program} #{command} #{f+' ' unless f.to_s == ''}#{dependency}" |