Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
trap("SIGINT") { exit! } | |
total_width = `stty size`.scan(/\d+/)[1].to_i # terminal width | |
snowflakes = {} | |
puts "\033[2J"; # clearing output | |
loop do | |
snowflakes[rand(total_width)] = 0 |
page :home do | |
header do | |
add_link 'Home', to: :home | |
add_link 'Posts', to: :posts | |
end | |
section :description, layout: :horizontal do | |
section :image do | |
add_image '/some/image' |
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 |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,