Skip to content

Instantly share code, notes, and snippets.

View loujaybee's full-sized avatar
🖥️
Codin'

Lou Bichard loujaybee

🖥️
Codin'
View GitHub Profile
@loujaybee
loujaybee / stripePlanCreate.js
Created November 14, 2017 09:26
stripeCreatePlan.js
stripe.plans.create(
{
amount: 1000,
name: "A monthly membership",
id: "monthly-membership",
interval: "month",
currency: "gbp"
},
{
@loujaybee
loujaybee / stripeCustomerCreate.js
Created November 14, 2017 09:27
Stripe Create A Customer (NodeJS)
stripe.customers.create({
description: "A new member, called Linda!",
source: "tok_visa"
},{
stripe_account: req.body.account
});
@loujaybee
loujaybee / stripeSubscriptionsCreate.js
Created November 14, 2017 09:28
Stripe Create Subscriptions
stripe.subscriptions.create({
customer: "your-customers-id",
plan: "monthly-membership",
application_fee_percent: 5
}, {
stripe_account: req.body.account
})
describe('GIVEN I am not an admin user', function () {
describe('WHEN Navigate to the page /admin ', function () {
it('THEN I see a warning box stating: "You do not have access to this page" ', () => {
Page.navigate('/admin')
expect(Page.elementContains('#error-message', 'You do not have access to this page')).toBeTrue();
});
});
});
@loujaybee
loujaybee / gist:60f54c9fbedcae7b4ea5e8f6f49ba73e
Created July 10, 2018 09:06
Basic Reduce Implementation
Array.prototype.reduceLou = function( func, start = 0 ){
let state = start;
for(let i = 0; i < this.length; i++) {
state = func(state, this[i]);
}
return state;
@loujaybee
loujaybee / postgres-transaction-api-clean-up.js
Last active October 1, 2018 08:13
Postgres transaction clean up
const db = require('../../database/db.js');
// The following would be library code, touched barely ever
const _executeTransaction = async(transaction) => {
try {
return await db.tx(transaction);
} catch (e) {
console.log(e);
// Handle DB error
}
@loujaybee
loujaybee / toggleDAZN
Created March 8, 2019 12:05
Toggle DAZN 2.0 / 1.0 (add to your bookmarks)
javascript:
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 *1000));
var expires = "; expires=" + date.toGMTString();
} else {
var expires = "";
@loujaybee
loujaybee / gist:160973a023193a6f3567772b87218671
Created April 9, 2019 14:33
Break IE10 with console.warn
var toCurry = function (func) {
return function (val) {
func(val);
}
};
toCurry(console.warn)('sdfsdf');
@loujaybee
loujaybee / circular.js
Last active May 13, 2019 11:34
Get out of the circular!
class Initialisation {
constructor() {
this.aFunctionThatThrowsImmediately();
this.aFunctionThatThrowsLater();
}
// Fake stuff to show the return values of module
aFunctionThatThrowsImmediately() {
console.log(this.errorCallback()); // error thrown, but platform not set
}
@loujaybee
loujaybee / zipped-lambda-s3-github-action.yaml
Created October 12, 2019 14:09
Push A Lambda Zipped Artifact to S3 Using Github Actions
- name: Make artifact directory
run: mkdir -p ./artifacts/${{ github.repository }}
- name: Create Zip File
uses: montudor/action-zip@v0.1.0
with:
args: zip -r ./artifacts/${{ github.repository }}/${{ github.sha }}.zip ./src
- name: Push Zip to S3
uses: jakejarvis/s3-sync-action@v0.3.1