Skip to content

Instantly share code, notes, and snippets.

{
VaultList: [{
CreationDate: "2018-02-23T17:13:21.063Z",
NumberOfArchives: 0,
SizeInBytes: 0,
VaultARN: "arn:aws:glacier:us-west-2:12334432:vaults/TimeMachine",
VaultName: "TimeMachine"
}]
}
def create_name()
date = Time.now.strftime("%Y%m%d")
serial = 1
name = {"#{@obj_name}-#{date}-#{format('%02d', serial)}#{@obj_ext}"}
while @objects.any?{|key, value| key == name}
serial += 1
name = {"#{@obj_name}-#{date}-#{format('%02d', serial)}#{@obj_ext}"}
end
name
end
@holmser
holmser / code_review.rb
Created March 18, 2016 03:16
Code Review
# original
if request_hash[:query_string][1] then
request_hash[:location] = request_hash[:query_string][0]
temp_hash = Hash.new
request_hash[:query_string][1].split("&").each do |pair|
temp = pair.split("=")
temp_hash[temp[0].to_sym] = temp[1]
end
request_hash[:query_string] = temp_hash
end
{
"allow" : [
"pe-internal-dashboard"
],
"match-request" : {
"method" : [
"get",
"put",
"delete"
],

Keybase proof

I hereby claim:

  • I am holmser on github.
  • I am holmser (https://keybase.io/holmser) on keybase.
  • I have a public key whose fingerprint is 2709 CB79 0F71 3950 DD6F D00B A507 FB15 6058 2FB1

To claim this, I am signing this object:

def build_uri(hostname, action)
uri = URI.parse(hostname) #parses the user input for hostname
uri.host = uri.path if (!uri.host && uri.path) # f
uri.scheme = URI_SCHEME #unless uri.scheme #adds http if not specified by user
uri.port = URI_PORT #unless uri.port #adds port if not specified by the user
uri.path = URI_PATH + action +".json" #if no, we use the default path specified
#puts uri.path
#puts uri
## TO DO handle more variations of URI
return uri