Skip to content

Instantly share code, notes, and snippets.

Avatar

Mika Turunen mikaturunen

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am mikaturunen on github.
  • I am mikaturunen (https://keybase.io/mikaturunen) on keybase.
  • I have a public key ASC7i2yfk0IGzu9ClXoYa2esH5qsujf2gQnOfR93F88Hygo

To claim this, I am signing this object:

@mikaturunen
mikaturunen / calculateHmac.js
Last active Aug 20, 2017
Example of calculating hmac in node.js
View calculateHmac.js
import * as crypto from 'crypto'
const merchantSecret = 'secret'
const hash = 'sha256'
const encoding = 'base64'
const payload = {
id: 123,
somethingElse: 'not 123'
}
@mikaturunen
mikaturunen / gist:f0b45def06bc83ccea9e
Created Jan 31, 2015
One way of hooking a callback from Angulars specific scope to HTML elements onload event
View gist:f0b45def06bc83ccea9e
// There is no direct way of binding angular to elements onload event as commonly the HTML elements onload="" attribute looks into the
// Javascript global name space (window.*) which is a big no-no. It used to be the norm back in the day of how to do things but with
// modern frameworks like AngularJs and the such the approach has changed a lot.
// This is just one example (and by no means the only way) of how to get Angular behave nicely with HTML elements onload event. As
// <iframe onload="test()"> looks into window.test for a callback we need to bound the onload event to look into provided angular scope
// for the callback.
// NOTE: Written in ES6