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 Papertrail | |
module Zookeeper | |
class NodeWatcher | |
include Watchable | |
attr_reader :name | |
def initialize(zk, name, options = {}) | |
@zk = zk | |
@name = name |
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
>> engine = ArelBack::Engine.new(ar.connection, Arel::Visitors::MySQL) | |
>> table = Arel::Table.new(ar.table_name, engine) | |
>> table.project(Arel.sql('*')).to_sql | |
=> "SELECT * FROM `awesome_table` " | |
>> |
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
process = (data) -> | |
keyMaker = (d) -> | |
time = d.time | |
if time not instanceof Date | |
time = new Date(time * 1000) | |
+d3.time.day.floor(time) / 1000 | |
nestedData = d3.nest() | |
.key(keyMaker) | |
.rollup((v) -> d3.sum(v, (d) -> d.value)) |
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
function barChart() { | |
var margin = {top: 0, right: 10, bottom: 20, left: 40}, | |
width = 960, | |
height = 500, | |
spacing = .1; | |
var key = defaultKey, | |
value = defaultValue, | |
valueFormat = d3.format(",.f"), | |
valueDomain = null; |
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 | |
# | |
# Annotate your "bundle outdated" with GitHub compare URLs | |
# | |
require 'open-uri' | |
require 'json' | |
def rubygems_gem_info(gem_name) |
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
# | |
# Created by Eric Lindvall <[email protected]> | |
# | |
class KestrelMonitor < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: Kestrel host | |
default: localhost | |
port: |
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 'lazy' | |
require 'system_timer' | |
class LibratoMetric | |
COUNT = 10 | |
RESOLUTION = 1 | |
def initialize(metric_name, timeout = 5) | |
@metric_name = metric_name | |
@timeout = timeout |
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 'lazy' | |
require 'system_timer' | |
class LibratoMetric | |
COUNT = 10 | |
RESOLUTION = 1 | |
def initialize(metric_name, timeout = 5) | |
@metric_name = metric_name | |
@timeout = timeout |
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 KestrelQueueMonitor < Scout::Plugin | |
OPTIONS=<<-EOS | |
host: | |
label: Host | |
notes: Kestrel host | |
default: localhost | |
port: | |
label: Port | |
notes: Kestrel admin HTTP port | |
default: 2223 |
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 'lazy' | |
require 'system_timer' | |
class ScoutMetric | |
M60_ALPHA = (1 - Math.exp(-5.minutes / 1.hour.to_f)) | |
NS_IN_SECONDS = 1000000000 | |
def initialize(metric_id, timeout = 5) | |
@metric_id = metric_id | |
@timeout = timeout |