Skip to content

Instantly share code, notes, and snippets.

@prognostikos
prognostikos / vipps_validates_webhook.rb
Last active August 8, 2023 07:22
Ruby validator for Vipps Webhook requests
View vipps_validates_webhook.rb
require "active_support/security_utils"
require "digest/sha2"
require "openssl/hmac"
require "uri"
module Vipps
# Validates webhook requests, documented at:
# https://developer.vippsmobilepay.com/docs/APIs/webhooks-api/request-authentication/
#
class ValidatesWebhook
View keybase.md

Keybase proof

I hereby claim:

  • I am prognostikos on github.
  • I am prognostikos (https://keybase.io/prognostikos) on keybase.
  • I have a public key ASCFuqFtBo3dqi365nkqVNF4X2vgD3v-9VF1s-jLBwzxZgo

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am prognostikos on github.
  • I am prognostikos (https://keybase.io/prognostikos) on keybase.
  • I have a public key whose fingerprint is B309 8CF8 43B4 FC0A 36B7 8775 1E36 68A2 A42B 3FC3

To claim this, I am signing this object:

View 0-notes.md

Pub-Sub patterns for better OO code

  • it's not new; it's just event-driven programming
  • GoF observer pattern

I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning -- it took a while to see how to do messaging in a programming language efficiently enough to be useful) - Allen Kay

@prognostikos
prognostikos / app.js
Created September 11, 2012 13:45
AngularJS & Rails
View app.js
/**
* Angular needs to send the Rails CSRF token with each post request.
*
* Here we get the token from the meta tags (make sure <%= csrf_meta_tags %>
* is present in your layout.)
*/
angular.module('myapp',[]).
// configure our http requests to include the Rails CSRF token
config(["$httpProvider", function(p) {
var m = document.getElementsByTagName('meta');
@prognostikos
prognostikos / mt.rb
Created May 28, 2012 20:23 — forked from alanq/mt.rb
DCI in ruby without injection - MoneyTransfer example
View mt.rb
-----------------------------------------
Boilerplate code (in rails_app_root/lib)
-----------------------------------------
module ContextAccessor
def context
Thread.current[:context]
end
end
@prognostikos
prognostikos / hack.sh
Created April 1, 2012 07:49 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#