Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
@nogweii
nogweii / xmas_tree.rb
Created December 22, 2018 20:50 — forked from mehdi-farsi/xmas_tree.rb
A light-up christmas tree in your terminal
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
jp2a picture.jpg --colors --invert | head -n20 | sed 's/\^[\[37m \^[\[0m/ /g' > picture.ansi
# Subject: Re: Newbie to Sinatra looking for example
# From: Ryan Tomayko <r@tomayko.com>
# To: sinatrarb@googlegroups.com
# 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.
# >
@nogweii
nogweii / irbrc_hax0r.rb
Created October 21, 2009 13:36 — forked from scrooloose/irbrc_hax0r.rb
Awesome l33t method listings. Requires http://github.com/oggy/looksee/tree/master
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
# put this in ~/.zshrc
# No alias needed! The `whence -p` does a path search.
function ruby() { [[ "$1" == "" ]] && irb || `whence -p ruby` $@ }