Skip to content

Instantly share code, notes, and snippets.

View abovedave's full-sized avatar

David Longworth abovedave

View GitHub Profile
/^[a-zA-Z0-9_!&=`~#%'\/\$\^\|\+\?\{\}-]+(\.[a-zA-Z0-9_!&=`~#%'\/\$\^\|\+\?\{\}-]+)*@[a-zA-Z0-9]([a-zA-Z0-9_-])*(\.[a-zA-Z0-9][a-zA-Z0-9_-]*)+$/
const config = require(__dirname + '/../../../stripe.json')
const stripe = require('stripe')(config.secret)
const apiCongig = require('@dadi/api').Config
const Model = require('@dadi/api').Model
module.exports = (obj, type, data) => {
switch(type) {
case 'beforeCreate':
const config = require(__dirname + '/../../../stripe.json')
const stripe = require('stripe')(config.secret)
const apiCongig = require('@dadi/api').Config
const Model = require('@dadi/api').Model
module.exports = (obj, type, data) => {
let customer = {}
/*
Notes:
- Add class 'js-form-validate' to form you want to use and 'js-validate' to each field.
- Disables buttons with class 'btn' until form is valid.
- Uses HTML 5 'required' and 'pattern' attributes. 'title' provides the validation description to the user.
- Script adds a <span class="js-hint"></span> to the output after each <input> element for the error message.
- You can see more helper classes in the code below. e.g., 'has-error'.
Examples:
@abovedave
abovedave / gist:a36e7f2659bb56dba442dd08d4ec36a1
Created September 20, 2018 23:01
nginx .test domains locally
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;

Keybase proof

I hereby claim:

  • I am abovedave on github.
  • I am djl (https://keybase.io/djl) on keybase.
  • I have a public key whose fingerprint is 41C3 3F81 6988 1E75 EF14 B6EA D13A 8253 2635 C319

To claim this, I am signing this object:

@abovedave
abovedave / jira.css
Last active March 9, 2016 15:09
Makes Jira look nicer
body {
font-size: 105%;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body.ghx-scroll-columns {
overflow: auto !important;
}
#header {
position: fixed;
z-index: 100;
$lang['fr'] = [
"checkoutTitle" => "Purchase from La Pèira",
"subTotal" => "Subtotal",
"tax" => "Tax",
"total" => "Total",
"fullName" => "Full name",
"addressLineOne" => "Address line one",
"addressLineTwo" => "Address line two",
"cityOrTown" => "City/Town",
"postCode" => "Post code",
@abovedave
abovedave / gist:ea846f79a2b139676bc9
Created August 21, 2014 09:23
Retina images replacement
if(window.devicePixelRatio >= 1.2){
var images = document.getElementsByTagName('img');
for(var i=0;i < images.length;i++){
var attr_2x = images[i].getAttribute('data-2x');
if(attr_2x){
images[i].src = attr_2x;
}
}
// ------------------------
// Syntax 'input:class:target' for toggling classes
// E.g., data-class="body:show-nav:header nav"
$('[data-class]').each(function(){
var self = $(this),
input = self.data('class').split(':'),
root = $(input[0]),
theclass = input[1],
target = $(input[2]),