Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am duien on github.
  • I am duien ( on keybase.
  • I have a public key ASCCiqcEJdd6wxN8PjxXBDUimnN-DLX3Kslfq0xIz_-WeAo

To claim this, I am signing this object:

View node_modules
grand-central-ui@1.0.0 /Users/ehyland/Code/Go/src/
├─┬ array-includes@3.0.2
│ ├─┬ define-properties@1.1.2
│ │ ├── foreach@2.0.5
│ │ └── object-keys@1.0.11
│ └─┬ es-abstract@1.7.0
│ ├─┬ es-to-primitive@1.1.1
│ │ ├── is-date-object@1.0.1
│ │ └── is-symbol@1.0.1
│ ├── function-bind@1.1.0
View Brilliant.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Transition plan for dashboard v2 models

Current state of things

  • There’s a dashboard v2 model that combines most functionality of standard and collection dashboards
  • There’s a v2 API namespace that uses new dashboard models
  • Those models can’t be associated with a collection yet
  • Most collection code is in place but commented out
  • Metric widgets can only be used by v2 dashboards
  • The /pin endpoint does not support NRQL widgets

The plan

  • Spend some time playing with the v2 dashboard models and see what needs fixing up
View tasks.rb
require 'term/ansicolor'
class String
include Term::ANSIColor
class Task
attr_accessor :status, :text, :indent_level
def to_formatted_string
"#{indent}- #{formatted_status} #{text}"
View Data Munging.mkd

Data Munging

Adapted from CodeKata.

Last month, James showed us how to parse CSV. Here's a chance to practice, and to try something more like a real-world programming problem. You'll want to check out the CSV class in Ruby's standard library to help you.

Part One: Weather Data

In weather.csv you’ll find daily weather data for Morristown, NJ for June 2002. Download this file, then write a program to output the day number with the smallest temperature spread. The day number is in a column labeled Dy, the max temperature is MxT and the min temperature is MnT.

duien / fizz_buzz.rb
Created Jan 31, 2013
Assignment for the first Rails Girls meetup
View fizz_buzz.rb
# Write a program that prints the numbers from 1 to 100. But for multiples of
# three print 'Fizz' instead of the number and for the multiples of five print
# 'Buzz.' For numbers which are multiples of both three and five print
# 'FizzBuzz.'
def fizz_buzz( limit = 100 )
1.upto(limit) do |i|
print "Fizz" if i % 3 == 0
print "Buzz" if i % 5 == 0
print i if i%3 != 0 and i%5 != 0
duien / glitch_time.js
Created Sep 2, 2011
Glitch Date/Time calculation in JavaScript
View glitch_time.js
function time_to_glitch(time){
var year, day_of_year, month_and_day, month, day_of_month, hour, minute, sec, ts ;
sec = Number(time) - 1238562000;
// there are 4435200 real seconds in a game year
// there are 14400 real seconds in a game day
// there are 600 real seconds in a game hour
// there are 10 real seconds in a game minute
year = Math.floor(sec / 4435200);
View gist:818746
ruby-1.8.7-p302 > require 'builder'
=> true
ruby-1.8.7-p302 > xm =
=> <inspect/>
ruby-1.8.7-p302 > xm.title('yada')
=> "<inspect/><title>yada</title>"
ruby-1.8.7-p302 > puts xm
TypeError: Builder::XmlMarkup#to_ary should return Array
from (irb):5:in `puts'
from (irb):5
duien / gist:817421
Created Feb 8, 2011
Mongo Atlanta Notes
View gist:817421

Tweet photo with #mongoatl to win!
Fur bus will shuttle back & forth to after-party, where there are 2 free drinks

Building an application with MongoDB

Will cover:

  • Data modeling, queries, geospacial, updates, map-reduce
  • Using location-based app as an example