diff options
author | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-08-14 05:23:57 -0400 |
---|---|---|
committer | Daniel Beauchamp <daniel.beauchamp@shopify.com> | 2012-08-14 05:23:57 -0400 |
commit | 54c6a04b722663b518bf99b4d98a1c2e86ee5103 (patch) | |
tree | 91cc311d76bcdd0c6fb053798b383fbeb44c4063 /templates/project/jobs | |
parent | 8e3ca1d64444408677c93721c198908de43fa417 (diff) |
Updated the sample project.
Diffstat (limited to 'templates/project/jobs')
-rw-r--r-- | templates/project/jobs/buzzwords.rb | 9 | ||||
-rw-r--r-- | templates/project/jobs/convergence.rb | 13 | ||||
-rw-r--r-- | templates/project/jobs/sample.rb | 12 |
3 files changed, 30 insertions, 4 deletions
diff --git a/templates/project/jobs/buzzwords.rb b/templates/project/jobs/buzzwords.rb new file mode 100644 index 0000000..109dc60 --- /dev/null +++ b/templates/project/jobs/buzzwords.rb @@ -0,0 +1,9 @@ +buzzwords = ['Paradigm shift', 'Leverage', 'Pivoting', 'Turn-key', 'Streamlininess', 'Exit strategy', 'Synergy', 'Enterprise', 'Web 2.0'] +buzzword_counts = Hash.new({ value: 0 }) + +SCHEDULER.every '2s' do + random_buzzword = buzzwords.sample + buzzword_counts[random_buzzword] = { label: random_buzzword, value: buzzword_counts[random_buzzword][:value] + 1 } + + send_event('buzzwords', { items: buzzword_counts.values }) +end
\ No newline at end of file diff --git a/templates/project/jobs/convergence.rb b/templates/project/jobs/convergence.rb new file mode 100644 index 0000000..f66b6a5 --- /dev/null +++ b/templates/project/jobs/convergence.rb @@ -0,0 +1,13 @@ +points = [] +(1..10).each do |i| + points << { x: i, y: rand(50) } +end +last_x = points.last[:x] + +SCHEDULER.every '2s' do + points.shift + last_x += 1 + points << { x: last_x, y: rand(50) } + + send_event('convergence', points: points) +end
\ No newline at end of file diff --git a/templates/project/jobs/sample.rb b/templates/project/jobs/sample.rb index 54a0e60..2314dc2 100644 --- a/templates/project/jobs/sample.rb +++ b/templates/project/jobs/sample.rb @@ -1,5 +1,9 @@ -SCHEDULER.every '5s' do - send_event('synergy', { value: (rand * 1024).floor }) - send_event('convergence', { value: (rand * 1024).floor }) - send_event('paradigm_shift', { value: (rand * 1024).floor }) +current_valuation = 0 + +SCHEDULER.every '2s' do + last_valuation = current_valuation + current_valuation = rand(100) + + send_event('valuation', { current: current_valuation, last: last_valuation }) + send_event('synergy', { value: rand(100) }) end
\ No newline at end of file |