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
Letters = (?A..?Z).to_a | |
Words = %w[AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY BA BE BI BO | |
BY DE DO ED EF EH EL EM EN ER ES ET EX FA GO HA HE HI HM HO | |
ID IF IN IS IT JO KA LA LI LO MA ME MI MM MO MU MY NA NE NO | |
NU OD OE OF OH OM ON OP OR OS OW OX OY PA PE PI RE SH SI SO | |
TA TI TO UH UM UN UP US UT WE WO XI XU YA YE YO] # http://phrontistery.info/scrabble3.html | |
Separator = "|" | |
puts " " + Separator + Letters * (" " + Separator) | |
Letters.each do |first| |
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 = 5 | |
def permutations digits | |
return [0, 1] if digits == 1 | |
permutations(digits-1).map { |d| [0, d].flatten } + | |
permutations(digits-1).reverse.map { |d| [1, d].flatten } | |
end | |
puts permutations(N).map &:join |
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 EventList | |
Event = Struct.new :type, :time | |
attr_reader :events | |
def initialize | |
@events = [] | |
end | |
def push type, time |
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
{ | |
"^m" = { | |
"/" = ("insertText:", "\U203D"); /* interrobang */ | |
"~/" = ("insertText:", "\U2E18"); /* gnaborretni */ | |
"," = ("insertText:", "\U2665"); /* black heard */ | |
"." = ("insertText:", "\U3006"); /* closing mark */ | |
"%" = ("insertText:", "\U3003"); /* ditto mark */ | |
";" = ("insertText:", "\U22EE"); /* vertical ellipsis */ | |
"A" = ("insertText:", "\U00A0\U00A0\U25B2\n\U25B2\U00A0\U25B2"); /* triforce */ | |
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 | |
# This file is on GitHub as a gist, at http://gist.github.com/293054. | |
WEATHER_STATION = "Glostrup" # Edit this, obviously. | |
begin | |
require 'open-uri' | |
require 'hpricot' | |
rescue LoadError | |
# To ensure the ability to use rubygems without specifying it, while still |
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
NUMBERS = { | |
:a => 1, | |
:one => 1, | |
:two => 2, | |
:three => 3, | |
:four => 4, | |
:five => 5, | |
:six => 6, | |
:seven => 7, | |
:eight => 8, |
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 Foo | |
module Object | |
module Bar | |
Object::Foo rescue "Not found." # => "Not found." | |
Object::Bar # => Foo::Object::Bar | |
::Foo # => Foo | |
::Bar rescue "Not found." # => "Not found." | |
end | |
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
⋮ | |
SNOW_FUNC(object_property) { | |
REQUIRE_ARGS(3); | |
SnSymbol name = ARGS[0]; | |
ASSERT_TYPE(name, SN_SYMBOL_TYPE); | |
VALUE getter = ARGS[1]; | |
VALUE setter = ARGS[2]; |
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
mikael@maggie ~//Snow ☁ snow -i | |
gc: nursery is at 0x100300000 | |
snow> require("lib/socket") | |
attempting to load file: /Users/mikael/Projects/Snow/lib/socket | |
attempting to load file: /Users/mikael/Projects/Snow/lib/socket.sn | |
attempting to load file: /Users/mikael/Projects/Snow/lib/socket.so | |
loading dynamic library: Snow Socket I/O Library version 1 | |
Socket init called. | |
=> true | |
snow> s: Socket("66.102.9.103", 80) // 66.102.9.103 = Google |
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
alert("Hello World!") |
NewerOlder