Skip to content

Instantly share code, notes, and snippets.

View Tuman829's full-sized avatar

Boris Tuman Tuman829

View GitHub Profile
@xadn
xadn / address conversion
Created February 27, 2011 21:03
Ruby zero pad a number and convert it to binary
# add leading zeros to a number
def zero_pad(target_length, input_string)
pad_length = target_length - input_string.length
"0" * pad_length + input
end
# convert a number to binary