Skip to content

Instantly share code, notes, and snippets.

View paulwcy's full-sized avatar
🔨
smashing

Paul Wong paulwcy

🔨
smashing
  • Melbourne Australia
View GitHub Profile

Keybase proof

I hereby claim:

  • I am paulwcy on github.
  • I am paulwong (https://keybase.io/paulwong) on keybase.
  • I have a public key ASAvWZALDIaQhrD8ZRHRDPR7d8i8yDfK4uNriZ65u9yj2Ao

To claim this, I am signing this object:

@paulwcy
paulwcy / providerNumberCheck.js
Last active February 28, 2017 00:36
Australian Medicare Provider Number Check
const locTable = '0123456789ABCDEFGHJKLMNPQRTUVWXY';
const checkTable = 'YXWTLKJHFBA';
const weights = [3, 5, 8, 4, 2, 1];
const re = new RegExp(`(\\d{5,6})([${locTable}])([${checkTable}])`);
function padLeftZero(n, len) {
let s = n ? n.toString() : '';
if (s.length < len) {
s = (`0000${s}`).slice(-len);
}
@paulwcy
paulwcy / gist:3373419
Created August 16, 2012 20:36
Express-messages 3.x - configuration
app.use(function(req, res, next) {
res.locals.messages = require('express-messages')(req, res)
next()
})