Skip to content

Instantly share code, notes, and snippets.

Avatar

Joel Dayjo

View GitHub Profile
View gocardless-events.md

Mandate actions

created

The mandate has been created.

submitted

The mandate has been submitted to the banks, and should become active in a few days, unless the bank declines the request.

active

The mandate has been successfully set up by the customer's bank.

@Dayjo
Dayjo / _link.md
Last active Nov 18, 2015
Proposal for adding _link to API resources
View _link.md
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype
@Dayjo
Dayjo / invoices.php
Last active Aug 29, 2015
Script to update subscription vat rates based on last invoice
View invoices.php
<?php
// Get everyone's "last subscription invoice" for people who've paid in the last year
$sql = "SELECT i1.vatrate, i1.username
FROM invoices i1
LEFT JOIN invoices i2 ON (i1.username = i2.username AND i1.id < i2.id)
WHERE i2.id IS NULL
AND i1.datestamp > '2014-04-01'
AND i1.type IN ('sub','subpayment','upgrade','resubscription')
ORDER BY i1.vatrate DESC";
@Dayjo
Dayjo / discount-tax.md
Last active Aug 29, 2015
User Stories for Discount and Tax
View discount-tax.md

Exclusive of VAT

Scenario 1

  • Product prices are Exclusive of VAT
  • No Discount Code
  • Cart Contains
  • 1 x ProductA £10.00 (20% VAT)
  • 1 x ProductB £10.00 (15% VAT)
View markdown.md
  1. item 4
  2. item one
  3. item three
  4. item two
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
View related_products.inc.php