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 ChristmasTree | |
FIRST_LINE_LENGTH = 1 | |
LEVEL_HEIGHT = 3 | |
COLORS = ["\033[0m", "\033[0m", "\033[0m", "\033[31m", "\033[33m", "\033[32m", "\033[34m"] # red, yellow, blue | |
def initialize(levels) | |
@levels = levels.to_i < 1 ? 3 : levels.to_i | |
@last_line_length = 5 + ((@levels - 1) * 2) | |
@current_line_length = FIRST_LINE_LENGTH | |
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
jp2a picture.jpg --colors --invert | head -n20 | sed 's/\^[\[37m \^[\[0m/ /g' > picture.ansi |
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
# Subject: Re: Newbie to Sinatra looking for example | |
# From: Ryan Tomayko <[email protected]> | |
# To: [email protected] | |
# Content-Type: text/plain; charset=UTF-8 | |
# | |
# > Alright, so I'm pretty new to both Sinatra and web applications, and I | |
# > was wondering if someone could write up a quick example use of | |
# > Sinatra. Basically I want to see how Sinatra handles <form>s in one | |
# > view, and then shows the input on a different view. | |
# > |
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
require 'rubygems' | |
require 'looksee' | |
module Kernel | |
alias_method :orig_methods, :methods | |
def methods(*args) | |
if caller.first =~ /\(irb\):\d+:in `irb_binding'/ | |
Looksee.lookup_path(self, *args) | |
else | |
orig_methods |
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
# put this in ~/.zshrc | |
# No alias needed! The `whence -p` does a path search. | |
function ruby() { [[ "$1" == "" ]] && irb || `whence -p ruby` $@ } |