Skip to content

Instantly share code, notes, and snippets.

View frankieroberto's full-sized avatar

Frankie Roberto frankieroberto

View GitHub Profile

Keybase proof

I hereby claim:

  • I am frankieroberto on github.
  • I am frankieroberto (https://keybase.io/frankieroberto) on keybase.
  • I have a public key whose fingerprint is 4903 EA7A 24DE 8CCF 649A B3C8 C295 20AB B910 60EA

To claim this, I am signing this object:

@frankieroberto
frankieroberto / README.md
Last active December 21, 2015 04:19
Number Widget

This is a widget that binds html input elements together, so that buttons and slider ranges can act as controls for other input elements.

def capitalize_initial(string)
if string.length > 0
string[0,1].capitalize + string[1..string.length]
else
""
end
end
@frankieroberto
frankieroberto / Useful helpers.rb
Created May 27, 2010 08:49
navigation_link_to
# A persistant navigation link, as used in "top navs" or "left navs".
# The main difference is that the link is replaced by a <span> tag when
# the link would otherwise lead to the page you're already on. This can be used
# for styling in CSS.
def navigation_link_to(name, options = {}, html_options = {})
if current_page?(options)
content_tag("span", name)
else
link_to name, options, html_options
end
def chart_path(data_values, h_value, options = {})
colour = options[:colour] || "000000"
height = options[:height] || "100"
width = options[:width] || "228"
background_colour = options[:background_colour] || "FFFFFF"
background_opacity = options[:background_opacity] || "00"
google_chart_path = "http://chart.apis.google.com/chart?chs=" + width + "x" + height + "&cht=ls"
google_chart_path += "&chd=t:" + data_values.to_s + "&chds=0," + h_value.to_s + "&chxt=y,x&chxl=0:||" + "" + "|1:|" + "" + "|" + "" + "&chco=" + colour + "&chf=bg,s," + background_colour + background_opacity