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 foo (bar) | |
>> "#{bar} baz" | |
>> end | |
=> nil | |
>> (0..5).collect &method(:foo) | |
=> ["0 baz", "1 baz", "2 baz", "3 baz", "4 baz", "5 baz"] | |
>> method(:foo) | |
=> #<Method: Object#foo> |
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 RuleBook | |
def initialize (&block) | |
@rules = [] | |
add_rules(&block) | |
end | |
def add_rules (&block) | |
instance_eval(&block) if block | |
self |
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
1 + 1 # Testing gist.vim |
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 'rufus/scheduler' | |
require 'openwfe/service' | |
require 'openwfe/listeners/listener' | |
module OpenWFE | |
class Emailistener < Service | |
include WorkItemListener |
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
# verbose | |
# | |
class NotifyThibaut0 < OpenWFE::ProcessDefinition | |
concurrence :count => 1 # terminate as soon as 1 branch replies | |
participant :ref => 'notify_thibaut' | |
cron :every => '1h' do | |
participant :ref => 'remind_thibaut' | |
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
class ActiveResourceParticipant | |
include OpenWFE::LocalParticipant | |
def initialize (options, &block) | |
@options = options | |
# some defaults | |
@options[:site] ||= 'http://127.0.0.1:3000' |
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 | |
require 'rubygems' | |
require 'daemons' | |
require 'rufus/scheduler' | |
scheduler = File.join(File.dirname(__FILE__), 'scheduler.rb') | |
options = { | |
:app_name => 'scheduler', | |
:ARGV => ARGV, |
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 A | |
def initialize | |
@on_exception = lambda {} | |
@t = Thread.new do | |
count = 0 | |
loop do | |
begin | |
puts count | |
count += 1 |
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' | |
require 'openwfe/engine/file_persisted_engine' # sudo gem install ruote | |
engine = OpenWFE::FilePersistedEngine.new( | |
:definition_in_launchitem_allowed => true) | |
# | |
# the process definition | |
class MyTodoProcess < OpenWFE::ProcessDefinition |
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' | |
require 'openwfe/engine' # sudo gem install ruote | |
require 'atom/feed' # sudo gem install atom-tools | |
# | |
# starting a transient engine (no need to make it persistent) | |
engine = OpenWFE::Engine.new(:definition_in_launchitem_allowed => true) |
OlderNewer