Skip to content

Instantly share code, notes, and snippets.

View msharp's full-sized avatar

max sharples msharp

  • Melbourne, Australia
View GitHub Profile
@msharp
msharp / markup.rb
Created August 6, 2012 07:24
markdown command wrapper
#!/usr/bin/ruby
require 'rubygems'
require 'github/markup'
if ARGV.length == 1
f = GitHub::Markup.render(ARGV[0])
puts f
else
raise "Usage: markup <source_file> [ > <destination_file> ]"
end
@msharp
msharp / Camelization.rb
Created February 16, 2012 23:55
Some functionas to camelize ruby hashes/objects for json output
# too much stuff to camelize the json object keys
# so that they are ready for the templates
def camelized(emp)
puts emp.inspect
if emp.is_a?(Array)
new = []
emp.each {|e| new << camelize_keys(e)}
else
new = camelize_keys(emp)
@msharp
msharp / indentity_correction.rb
Created January 27, 2012 04:32
Convert 4-space indents to 2-space indents
#!/usr/bin/ruby
#########################
#
# Convert rubycode with 4-space indents
# to regulation 2-space indenting format.
#
# supply directory as argument:
# > ruby indentity_correction.rb ./my_code_dir
#
@msharp
msharp / public_key.pub
Created November 28, 2011 22:49
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjUroth5dd9SB+U8SuAKnmGgrDPeHGFFwqAXKeNJ+wht6mVXLipDs01eVii3a7Ibkalh2v45+KleiQoXXYhaLuvuq1KskGU7lv5bJUcQWicoBWh/OtrrzmWHlsesq1EDXjqDL0bgm2sQ+efO5G1qnBhwZ7PNXH6CHb8ayuySk8m4N0R/8Sn188LwAdFy2jgcAWuOM8wXACK41JaH38HwMsgrjIphCoxZbAYtufa+wkqztEs546wBk6vDJn46J432LhxXuN5TY9BV043qLQl3Y9RDkRk5Siq63a3vioKYWsqlxIbiN0FAae9S6Klg0pVZYDsJajyYycMIJlGvAx7AGt
@msharp
msharp / pingdom_downtime_calculator.rb
Created August 24, 2011 04:19 — forked from mattfitzgerald/gist:1167255
pingdom downtime calculator
def calculate_downtime_minutes
check_id = 387085
user = "alerts@admin.mysquawkbox.com"
pass = "***"
key = "***"
today = DateTime.now.to_date
last_sunday = today - today.wday
@msharp
msharp / encodebase52
Created March 14, 2011 04:03
recursive base52 [a-Z] number encoding
function encode52(c) {
return (c < 52 ? '' : encode52(parseInt(c / 52))) + ((c = c % 52) > 25 ? String.fromCharCode(c + 39) : String.fromCharCode(c + 97));
};