This file contains hidden or 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 | |
filename = ARGV[0] | |
usage = "USAGE: largefile.rb <filename>" | |
unless filename | |
STDERR.write(usage + "\n") | |
exit(1) | |
end |
This file contains hidden or 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 UserInput | |
# Prompt for confirmation, exiting if not an affirmative. | |
def self.confirm!(message) | |
unless confirm(message) | |
STDERR.write("cancelling...\n") | |
exit | |
end | |
end | |
# Prompt for confirmation, returning a boolean indicating user's preference. |
This file contains hidden or 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
require 'pathname' | |
def each_recursive(dirpath, &block) | |
dirpath.each_entry do |entry| | |
next if "." == entry.to_s || ".." == entry.to_s | |
entry_path = dirpath + entry | |
if entry_path.directory? | |
each_recursive(entry_path, &block) | |
else |
This file contains hidden or 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
file = File.new(filename) | |
contents = file.read | |
newfile = Tempfile.new(filename) | |
begin | |
contents.each do |line| | |
newfile.write("// " + line) | |
end | |
newfile.flush |
This file contains hidden or 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 | |
filename = ARGV[0] | |
usage = "USAGE: commandline.rb <filename>" | |
unless filename | |
STDERR.write(usage + "\n") | |
exit(1) | |
end |
This file contains hidden or 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 | |
filenames = ARGV | |
usage = "USAGE: interleave.rb <filename> ..." | |
unless filenames.length > 0 | |
STDERR.write(usage + "\n") | |
exit(1) | |
end |
This file contains hidden or 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 | |
require 'rubygems' | |
require 'term/ansicolor' | |
ARGF.each_line do |line| | |
color = case line | |
when /^ERROR/ then Term::ANSIColor.red | |
when /^WARN/ then Term::ANSIColor.yellow | |
when /^INFO/ then Term::ANSIColor.green | |
else "" |
This file contains hidden or 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
div.page { | |
width: 90%; | |
margin: auto; | |
} | |
div.left_column { | |
width: 58.333333% | |
} | |
div.right_column { |
This file contains hidden or 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
/*Mobile first:*/ | |
.container { width: 16em; } | |
/*Tablet in Portrait Orientation:*/ | |
.container { width: 32em; } | |
@media (max-width: 33em) { | |
.container { width: 16em; } | |
} | |
/*Full Experience:*/ |
This file contains hidden or 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
body { | |
font: normal 100% Helvetica, Arial, sans-serif; | |
} |
OlderNewer