View Table Example
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
id, group_by_column1, group_by_column2, group_by_column3, class_id, value | |
1, "A", "1", "0", 6, 17 | |
2, "A", "1", "1", 6, 17 | |
3, "A", "1", "2", 6, 17 | |
4, "A", "1", "3", 6, 17 | |
5, "A", "1", "0", 5, 10 | |
6, "A", "1", "1", 5, 10 | |
7, "A", "1", "2", 5, 10 | |
8, "A", "1", "3", 5, 10 |
View test.rb
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 snapshot_description | |
initialization | |
@resp.snapshots.each do |n| | |
if name = n.tags.find { |t| t.key == 'Name' } | |
desc = name.value | |
end | |
if n.start_time < @threshold | |
@count += 1 | |
snapshot_list(n, desc) | |
end |
View gemtree.rb
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 | |
# -*- coding: utf-8 -*- | |
require 'optparse' | |
require 'ostruct' | |
# using list from graph gem | |
COLOR_SCHEME_MAX = { | |
accent: 8, blues: 9, brbg: 11, bugn: 9, | |
dark2: 8, gnbu: 9, greens: 9, greys: 9, |
View ruby-class-mixin-graph.rb
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 | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright (c) 2014 Marvin Gülker | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions | |
# are met: | |
# |
View gist:9444556
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 ReadIngredients | |
def perform | |
while input = gets.chomp | |
break if input == 'done' | |
yield input | |
end | |
end | |
end | |
ingredients = [] |
View regex.rb
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 = query.query_url.match(Regexp.union( | |
/form_code=(?<id>[a-zA-Z0-9]+)/, | |
/form\/.+?\/(?<id>[a-zA-Z0-9]+)/, | |
/iframe\/(?<id>[a-zA-Z0-9]+)/)) |
View 03-lottery.rb
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 draw n=6 | |
to_enum(__method__) unless block_given? | |
draw_all(n).each do |number| | |
break unless number | |
yield number | |
end | |
end | |
def draw_sorted n=6 | |
to_enum(__method__) unless block_given? |