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 Chainer | |
STATUSES = [ STATUS_SUCCESS = :success, STATUS_FAIL = :fail ] | |
def self.execute(context, *steps) | |
steps.each do |step| | |
step.execute context | |
break if context.fail? | |
end | |
context |
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 ComparableRange < Range | |
include Comparable | |
def self.new(r_start, r_end = nil, exclusive = false) | |
r_end ||= r_start | |
r_start, r_end = r_end, r_start if r_end < r_start | |
super | |
end | |
def overlaps(other) |
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 TimeSpan | |
def initialize(seconds) | |
@seconds = (seconds || 0).abs | |
end | |
def in_seconds | |
@seconds | |
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
vm.person = undefined; | |
vm.friends = undefined; | |
vm.people = [ | |
{ name: 'Jerry', id: 1 }, | |
{ name: 'Andy', id: 2 }, | |
{ name: 'Tom', id: 3 }, | |
{ name: 'Brian', id: 4 } | |
]; |
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
-- LISTAGG only works on user created tables, so need this hack | |
create table #cols (column_name varchar(255), ordinal_position int) | |
insert into #cols | |
select column_name, ordinal_position | |
from SVV_COLUMNS | |
where table_name = '<table name>' and table_schema = '<schema name>' | |
select LISTAGG(column_name, ', ') within group (order by ordinal_position) from #cols |