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
# OpenHash is a hash with a #method_missing method | |
# that routes to [] and []=. | |
class OpenHash < Hash | |
def method_missing(s, *a) | |
case s | |
when /\?$/ | |
self.key?(s.chomp('?')) | |
when /\=$/ | |
self[s] = a[0] | |
else |
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
BEGIN { | |
module Kernel | |
h = Hash.new | |
define_method(:requiree) do | |
h | |
end | |
r = method :require | |
define_method(:require) do |a| | |
r.call(a) | |
h[a] = caller |
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
def pc(*args) | |
super *(args << caller[0]) | |
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
"jp6iSZmkLp5ISZlEiW5C".unpack("m")[0].unpack("C*").map{|x|x.chr}.join. | |
unpack("B*")[0].scan(/.{24}/){i=7;$&.scan(/..../){print"\e[3#{i-=1};1;40m "; | |
$&.each_byte{|z|print" #"[z-?0,1]*2}};puts"\e[0m"} |
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="\033[2J\033[0;0H _\n Quack! >(')____,\n (` =~~/\n~^~^~^~^~^`---'~^~^~^~^"; | |
(1..(1/0.0)).each{|i|s[23,6]=(i%2)==0?"Quack!":" "*6;s.tr!('>~^^~<','<^~~^>');puts s;sleep 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
a=[];10.times{|n|a<<1;puts" "*(9-n)*3+"%6d"*-~n%a;n.times{|i|a[n]+=a[n-=1]}} | |
a=[];10.times{|n|a<<1;puts" "*(9-n)*3+"%6d"*(n+1)%a;n.times{|i|a[n]+=a[n-=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
n=32;l="A";n.times{|y|print" "*(n-1-y),(0..y).map{|x|~y&x>0?" .":" #{l}"},$/} |
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
"bp6siZmijp5CiZlCiW5CgAAChpbiiZYiiZZCi5aCZ2bs".unpack("m")[0].unpack("C*").map{|x| | |
x.chr}.join.unpack("B*")[0].scan(/.{24}/){i=7;$&.scan(/..../){ | |
print"\e[3#{i-=1};1;40m ";$&.each_byte{|z|print" #"[z-?0,1]*2}};puts"\e[0m"} |
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
loop{7.times{|i|puts"\e[2J\e[0;3H_...\n / _ '.\n|.'(@@@@@)\n(*)/ %s \\ | |
| .o. | \n ( %s ) %s"%[i==5?"- -":"e e",(i+3)%7<4?"=":"o",i>0?"-"+ | |
(" Ho"*i)[0,9]+"!":""];puts" ( )\n"*2," ( )\n"*3,' "-"'; | |
sleep([5,3,3,4,5,1,4][i]/6.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
require 'facets/functor' | |
class Object | |
# Use #instance_eval with a fluid notation. | |
# | |
# class X | |
# attr :a | |
# private :a | |
# def initialize |
OlderNewer