Skip to content

Instantly share code, notes, and snippets.

View virtualstyle's full-sized avatar

Rob Wood virtualstyle

View GitHub Profile
@virtualstyle
virtualstyle / hmac_auth.rb
Created May 23, 2018 21:55
Creating HMAC auth header in ruby for use in HTTParty header
require 'base64'
def auth_header(path: nil, method: 'get', body: nil)
date = Time.zone.now.httpdate
# ORDERED list of headers in request to be signed
auth_headers = 'host date'
if ['put', 'post'].include? method.downcase
@virtualstyle
virtualstyle / gist:1e9601287a2c46c040c297e67436e9d7
Created May 28, 2016 00:46
This gist is an answer to the Programming Challenge: "Determine if a String is an int or a double." for a job application.
<?php
function intOrDouble( $str ) {
if ( is_numeric( $str ) ) {
if ( strpos($str, ".") !== false ) {
return 1;
} else {