From 54c6a04b722663b518bf99b4d98a1c2e86ee5103 Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Tue, 14 Aug 2012 05:23:57 -0400 Subject: Updated the sample project. --- templates/project/jobs/buzzwords.rb | 9 +++++++++ templates/project/jobs/convergence.rb | 13 +++++++++++++ templates/project/jobs/sample.rb | 12 ++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 templates/project/jobs/buzzwords.rb create mode 100644 templates/project/jobs/convergence.rb (limited to 'templates/project/jobs') 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 -- cgit v1.2.3