Skip to content

Instantly share code, notes, and snippets.

Avatar

Le Huy huy

View GitHub Profile
@huy
huy / gist:6295999
Last active Dec 21, 2015
graphite diagram
View gist:6295999
digraph GraphiteHowItWorks {
labelloc="t"
label=<
<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0">
<TR><TD>
Graphite - How it works
</TD></TR>
</TABLE>
>
View promote1.rb
require './redis_client'
class RedisMonitor
CHECK_MASTER_PERIOD = 5
attr_accessor :verbose
def initialize(instances={})
@instances = instances
@huy
huy / Hash.from_xml
Created Feb 10, 2011
Convert xml to hash using Nokogiri
View Hash.from_xml
# USAGE: Hash.from_xml(YOUR_XML_STRING)require 'rubygems'
require 'nokogiri'
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#123129
7
class Hash
class << self
def from_xml(xml_io)
begin
result = Nokogiri::XML(xml_io)
You can’t perform that action at this time.