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 Array | |
def perms | |
return [ self ] if size < 2 | |
map { |e| | |
( self - [ e ] ).perms.map { |p| [ e ] + p } | |
}.flatten( 1 ) | |
end | |
end | |
p [ 'a', 'b', 'f', [ 1,2 ] ].perms |
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' | |
gem 'ramaze', '2009.04' | |
require 'ramaze' | |
class MainController < Ramaze::Controller | |
map '/' | |
def index | |
@message = "Hello!" | |
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
ETANNI_TEMPLATES = {} | |
ETANNI_TEMPLATES[:simple] = <<'T' | |
<h1>Nothing here</h1> | |
T | |
ETANNI_TEMPLATES[:small] = <<'T' | |
<?r 100.times do |n| ?> | |
#{n} | |
<?r 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
@template = %q{ | |
<div class="#{html_class}"> | |
<h3>#{capitalized_title}</h3> | |
<table> | |
#{trs} | |
</table> | |
<h3>#{title}</h3> | |
</div> | |
} |
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
diff --git a/CHANGELOG b/CHANGELOG | |
index 335e9b9..de6228d 100644 | |
--- a/CHANGELOG | |
+++ b/CHANGELOG | |
@@ -1,8 +1,22 @@ | |
Diakonos Changelog | |
------------------ | |
+0.8.11 | |
+ |
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
# DBI::Row.new(columns, column_types, size_or_array=nil) | |
# | |
# Returns a new DBI::Row object using +columns+. The +size_or_array+ | |
# argument may either be an Integer or an Array. If it is not provided, | |
# it defaults to the length of +columns+. | |
# | |
# Column types is a corresponding Array of Class/Module objects that | |
# conform to the DBI::Type interface. These will be used to convert types | |
# as they are returned. | |
# |
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 'better-benchmark' | |
r1 = Regexp.new( 'a' ) | |
r2 = /a/ | |
s = 'a' | |
puts 'Regexp.new vs. /regexp/' | |
result = Benchmark.compare_realtime( | |
:iterations => 10, |
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 'better-benchmark' | |
b = 'b' | |
r = /a#{b}/ | |
s = 'ab' | |
puts "Precreated interpolated vs. not precreated interpolated" | |
result = Benchmark.compare_realtime( | |
:iterations => 10, |
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 drawn with straight lines, followed by letters with curves. :) (Answer to http://friendfeed.com/pistos/e5d8bc50/my-6-year-old-asked-daddy-can-you-guess-sorting ) |