Skip to content

Instantly share code, notes, and snippets.

View matt-thomson's full-sized avatar

Matt Thomson matt-thomson

View GitHub Profile
require "cases/helper"
require 'support/schema_dumping_helper'
if ActiveRecord::Base.connection.supports_extensions?
class PostgresqlHstoreTest < ActiveRecord::PostgreSQLTestCase
include SchemaDumpingHelper
class Hstore < ActiveRecord::Base
self.table_name = 'hstores'
store_accessor :settings, :language, :timezone
@matt-thomson
matt-thomson / WebhookExample.java
Created April 17, 2015 15:46
Java webhook signature example
package com.gocardless.example;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class WebhookExample {
public static void main(String[] args) throws Exception {
String apiSecret = "ElfJ-3tF9I_zutNVK2lBABQrw-BgAhkZKIlvmbgk";
String webhookBody = "{\"events\":[{\"id\":\"EV0000ED6V59V1\",\"created_at\":\"2015-04-17T15:24:26.817Z\",\"resource_type\":\"payments\",\"action\":\"submitted\",\"links\":{\"payment\":\"PM00008Q30R2BR\"},\"details\":{\"origin\":\"gocardless\",\"cause\":\"payment_submitted\",\"description\":\"The payment has now been submitted to the banks, and cannot be cancelled. [SANDBOX TRANSITION]\"},\"metadata\":{}},{\"id\":\"EV0000ED6WBEQ0\",\"created_at\":\"2015-04-17T15:24:26.848Z\",\"resource_type\":\"payments\",\"action\":\"confirmed\",\"links\":{\"payment\":\"PM00008Q30R2BR\"},\"details\":{\"origin\":\"gocardless\",\"cause\":\"payment_confirmed\",\"description\":\"Enough time has passed since the payment was submitted for the banks to return an erro

Keybase proof

I hereby claim:

  • I am matt-thomson on github.
  • I am thomson_matt (https://keybase.io/thomson_matt) on keybase.
  • I have a public key whose fingerprint is 1307 3BF2 5395 66F9 3B63 5F97 6E9F 3969 D1CF 1C5D

To claim this, I am signing this object:

@matt-thomson
matt-thomson / mendeley-wolfram.m
Created July 26, 2014 12:59
Mendeley Wolfram Language example
clientId = "..."
clientSecret = "..."
CreateAuthHeader := "Basic " <> ExportString[clientId <> ":" <> clientSecret, "Base64"]
GetTokenJson := URLFetch["https://api.mendeley.com/oauth/token",
"Method" -> "POST",
"Headers" -> {"Authorization" -> CreateAuthHeader },
"BodyData" -> "scope=all&grant_type=client_credentials"
]