This file contains hidden or 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
| @participations = 0 | |
| @hacks.each do |hack| | |
| @participations += hack.hackers_count | |
| end | |
| unless @participations == 0 | |
| @average = sprintf("%.1f", (@hacks.length / @participations)) | |
| else | |
| @average = 0 | |
| end |
This file contains hidden or 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
| string = "stats.pages.home_page.visitors" | |
| split_string = string.split('.') | |
| tree = {} | |
| tree_string = 'tree' | |
| for i in range(0, len(split_string)): | |
| try: | |
| tree_string = tree_string + '[split_string[' + str(i) + ']]' | |
| exec(tree_string) | |
| except KeyError: |
This file contains hidden or 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
| import socket | |
| import sys | |
| import pickle | |
| import redis | |
| """ | |
| Basically, this bad boy needs to receive 500k pickled metrics of the type [name, (timestamp, | |
| value)] every 10 seconds. It needs to then unpickle them and pop them in Redis. When you fire | |
| it up, it works for about five seconds (just listening - not even Redising yet), and then it | |
| stops, with a weird exception in gen_unpickle: |
This file contains hidden or 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
| ~/code/hackerleague.org$ bundle exec foreman start | |
| 13:50:08 web.1 | started with pid 18516 | |
| 13:50:08 worker.1 | started with pid 18517 | |
| 13:50:20 web.1 | => Booting Thin | |
| 13:50:20 web.1 | => Rails 3.2.3 application starting in development on http://0.0.0.0:5000 | |
| 13:50:20 web.1 | => Call with -d to detach | |
| 13:50:20 web.1 | => Ctrl-C to shutdown server | |
| 13:51:39 web.1 | Exiting | |
| 13:51:39 web.1 | /Users/abestanway/.rvm/gems/ruby-1.9.2-p290/gems/mongo-1.6.2/lib/mongo/connection.rb:415:in `connect': Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure) | |
| 13:51:39 web.1 | from /Users/abestanway/.rvm/gems/ruby-1.9.2-p290/gems/mongo-1.6.2/lib/mongo/connection.rb:589:in `setup' |
This file contains hidden or 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
| # NOTE: Requires https://github.com/technoweenie/nubnub | |
| Client = require '../src/client' | |
| cli = Client.build( | |
| hub: "http://hub.etsy.com/" | |
| mode: "subscribe" | |
| verify: 'sync' | |
| topic: 'http://www.etsy.com/api/push/listings/latest.atom' | |
| callback: 'http://ec2-23-20-144-147.compute-1.amazonaws.com:8080/callback' | |
| apikey: 'YOURKEYHERE' |
This file contains hidden or 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
| var confirmed = true; | |
| var skype = "abe.stanway"; | |
| var hitMeUpYo = function(skype, confirmed){ | |
| confirmed | |
| ? console.log("Looking forward to speaking with you! My Skype is " + skype) | |
| : console.log("Sorry, gonna have to pass") | |
| }; | |
| hitMeUpYo(skype, confirmed); |
NewerOlder