Skip to content

Instantly share code, notes, and snippets.

View robjmills's full-sized avatar

Rob Mills robjmills

View GitHub Profile
@robjmills
robjmills / hmac-validation.js
Created November 16, 2022 08:50
Run Javascript in Code by Zapier for validating a HMAC signature in a webhook
let crypto = require('crypto');
let secret = inputData.secret;
let webhookBody = inputData.body;
let hmacSignature = inputData.hmacSignature;
let signature = crypto.createHmac('sha256', secret).update(webhookBody).digest("base64");
const validSignature = (signature === hmacSignature);
@robjmills
robjmills / klarna-order-with-voucher.php
Created April 11, 2019 11:22
Example of a Klarna checkout order with a voucher line item
<?php
$order = [
'amount' => 88,
'tax_amount' => 14.67,
'currency' => 'GBP',
'locale' => 'GB',
'purchase_country' => 'GB',
'notify_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__validation',
'return_url' => 'https://developers.klarna.com/api/#checkout-api__ordermerchant_urls__checkout',
editor = new PhotoEditorSDK.UI.DesktopUI({
container: editorContainer,
language: getLanguageCode(),
displayWelcomeMessage: false,
responsive: true,
license: getPhotoEditorSDKApiKey(),
editor: {
image: imageObj,
displayCloseButton: true,
enableExport: true,

Keybase proof

I hereby claim:

  • I am robjmills on github.
  • I am robjmills (https://keybase.io/robjmills) on keybase.
  • I have a public key whose fingerprint is 3A0F 6A61 9671 5602 5868 27D1 1F98 34F2 9C2B 5444

To claim this, I am signing this object:

@robjmills
robjmills / gist:5362511
Last active December 16, 2015 02:29 — forked from getify/gist:3884928
Modification for monokai theme for JSON files - edit ~/Library/Application Support/Sublime Text 2/Packages/Color Scheme - Default/Monokai.tmTheme
<dict>
<key>name</key>
<string>JSON String</string>
<key>scope</key>
<string>meta.structure.dictionary.json string.quoted.double.json</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#E6DB74</string>
</dict>
@robjmills
robjmills / gist:1634171
Created January 18, 2012 17:13
Compare schema of local database to remote/staging/production db
diff -biy --suppress-common-lines <(mysqldump -d --no-data --compatible=no_table_options --compact local_db) <(ssh root@REMOTE.IP.ADDRESS 'mysqldump -d --no-data --compatible=no_table_options --compact remote_db')