Skip to content

Instantly share code, notes, and snippets.

View AhmedAliIbrahim's full-sized avatar
🏠
Working from home

Ahmed A. Ibrahim AhmedAliIbrahim

🏠
Working from home
View GitHub Profile
@AhmedAliIbrahim
AhmedAliIbrahim / alien.rb
Created February 1, 2021 20:13
Allow Alien to talk to another Alien
class Alien
def can_talk_to?(character)
character.is_a?(Human) || character.is_a?(Alien)
end
end
@AhmedAliIbrahim
AhmedAliIbrahim / payfort_signature.rb
Last active March 16, 2017 08:04
how to create a payfort signature !
# key is payfort passphrase request or response
def sign_with_key(params, key)
string_to_digest = params.sort { |a, b| a[0].upcase <=> b[0].upcase }.map { |k, v| "#{k}=#{v}" }.join()
string_to_digest = "#{key}#{string_to_digest}#{key}"
Digest::SHA256.hexdigest(string_to_digest)
end