Skip to content

Instantly share code, notes, and snippets.

View dagosi's full-sized avatar
💎

Daniel Gomez-Sierra dagosi

💎
  • Remote
View GitHub Profile
### Keybase proof
I hereby claim:
* I am dagosi on github.
* I am dagosi (https://keybase.io/dagosi) on keybase.
* I have a public key ASAxw70jG9o2t4_bcNusveASwFZsl6sgidDRrm97Rb4GAwo
To claim this, I am signing this object:
<div class="btn-group" data-toggle="buttons">
<label class="btn green active"><input autocomplete="off" type="radio" value="VISA" checked="checked" name="credit_card[card_type]" id="credit_card_card_type_visa">VISA</label>
<label class="btn green"><input autocomplete="off" type="radio" value="Mastercard" name="credit_card[card_type]" id="credit_card_card_type_mastercard">Mastercard</label>
<label class="btn green"><input autocomplete="off" type="radio" value="Discover" name="credit_card[card_type]" id="credit_card_card_type_discover">Discover</label>
<label class="btn green"><input autocomplete="off" type="radio" value="American Express" name="credit_card[card_type]" id="credit_card_card_type_american_express">American Express</label>
</div>
@dagosi
dagosi / create_transaction_without_bill.sh
Last active January 11, 2018 19:53
Create a transaction without a bill
CURRENT_DATE=`date -Ru | sed 's/+0000/GMT/'`
CHECKSUM=$(echo -n "application/json,,/transactions,$CURRENT_DATE" \
| openssl dgst -sha1 -binary -hmac "your-secret-key" \
| base64)
curl "https://apix.casiregalii.com/transactions" \
-X POST \
-d '{
"account_number": "12345678998",
"amount": "2000.0",
@dagosi
dagosi / create_transaction_with_bill_id.sh
Created January 10, 2018 21:49
Create a transaction by using a bill ID
CURRENT_DATE=`date -Ru | sed 's/+0000/GMT/'`
CHECKSUM=$(echo -n "application/json,,/bills/<ID>/pay,$CURRENT_DATE" \
| openssl dgst -sha1 -binary -hmac "your-secret-key" \
| base64)
curl "https://apix.casiregalii.com/bills/<ID>/pay" \
-X POST \
-d '{"amount":5568.00, "currency":"USD"}' \
-H "Accept: application/vnd.regalii.v3.2+json" \
-H "Content-Type: application/json" \
@dagosi
dagosi / checksum_verification.sh
Created January 10, 2018 17:39
This example verifies that the creation of this checksum returns "nLet/JEZG9CRXHScwaQ/na4vsKQ="
CHECKSUM=$(echo -n "application/json,,/account,Wed, 02 Nov 2016 17:26:52 GMT" \
| openssl dgst -sha1 -binary -hmac "verify-secret" \
| base64)
# Thus we get:
echo $CHECKSUM # => nLet/JEZG9CRXHScwaQ/na4vsKQ=
@dagosi
dagosi / checksum.sh
Created January 10, 2018 17:35
Create a Checksum in Bash
CURRENT_DATE=`date -Ru | sed 's/+0000/GMT/'`
CHECKSUM=$(echo -n "application/json,,/account,$CURRENT_DATE" \
| openssl dgst -sha1 -binary -hmac "your-secret-key" \
| base64)
scope :show_by_keyword, (word)-> { joins(:keywords).where("keywords.name LIKE %#{word}%") }
@dagosi
dagosi / app.js
Last active September 3, 2015 20:58
var clicked = false;
$(document).on('click', function() {
clicked = true;
});
window.onunload = function() {
if($('.full-logout').length > 0 && !clicked) {
var logoutPath = $('.full-logout a').attr('href');
def parse_expressions(initial_expression)
expression_regex = /(\(\d[+\-]\d\))/
expressions = initial_expression.scan(expression_regex)
expressions.each do |expression|
result = calculator(expression.first)
initial_expression[expression.first] = result.to_s
end
calculator(initial_expression)