Skip to content

Instantly share code, notes, and snippets.

View stefatkins's full-sized avatar

Stefan stefatkins

  • Leeto
  • Lyon, France
View GitHub Profile
raw_post = request.raw_post
def generate_signature_from_raw_post(raw_post)
object_payload = JSON.parse(raw_post)['object_payload']
object_payload_dump = Oj.dump(object_payload, escape_mode: :ascii)
hmac = OpenSSL::HMAC.digest('sha256', ENV['SECRET'], object_payload_dump)
Base64.encode64(hmac).strip
end
@stefatkins
stefatkins / video-upload.js
Last active January 10, 2018 08:56
video upload to S3 with vue js
<template>
<div id="video-uploader" class="row-multiple --last">
<div v-show="ShowProgressBar">
<progress max="100" :value="progressPercentage"></progress>
<span>{{ progressPercentage }} % (veuillez patienter...)</span>
</div>
<input class="button secondary hollow --alt-margin" type='file' v-on:change='onFileChange'></input>
<input type='hidden' name="tutorial[video]" :value="videoData"></input>
</div>
</template>
@stefatkins
stefatkins / ruby
Last active September 10, 2015 15:06 — forked from koriroys/students.rb
For Ruby Wednesday Sep 16, 2015