Skip to content

Instantly share code, notes, and snippets.

@mcdavis
mcdavis / max_slice.rb
Last active August 29, 2015 14:22
Max Slice
def max_slice(numbers)
best_sum = nil
best_slice = nil
numbers.each_with_index do |number, index|
numbers[index..numbers.size].each_with_index do |inner_number, inner_index|
sum_nums = numbers[index..inner_index+1]
unless sum_nums.empty?
sum = sum_nums.inject(0) { |sum, x| sum += x }
@mcdavis
mcdavis / keybase.md
Created August 14, 2014 16:41
keybase.md

Keybase proof

I hereby claim:

  • I am mcdavis on github.
  • I am mcdavis (https://keybase.io/mcdavis) on keybase.
  • I have a public key whose fingerprint is C8B9 7030 CDC0 EF63 793A D267 26DA EC2A FB4A 6474

To claim this, I am signing this object:

@mcdavis
mcdavis / readme.md
Created August 22, 2013 23:57
Sonos for Hubot

Sonos for Hubot

screenshot

Requirements

  • Hubot
  • HUBOT_SONOS_HOST - an export set to an IP for a single sonos speaker. If grouped, it needs to be the main speaker in the group.
  • The bot has to be running somewhere where it can access your sonos speakers.