This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ----- Your Microservice ----- */ | |
// An imaginary database | |
const DATABASE = [{ id: 2, name: "Lou" }] | |
// library.js | |
function databaseLibrary() { | |
return { | |
findByID: (searched_id) => DATABASE.find(id => searched_id) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import axios from "axios"; | |
export default class extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
upload_file: null | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Make artifact directory | |
run: mkdir -p ./artifacts/${{ github.repository }} | |
- name: Create Zip File | |
uses: montudor/[email protected] | |
with: | |
args: zip -r ./artifacts/${{ github.repository }}/${{ github.sha }}.zip ./src | |
- name: Push Zip to S3 | |
uses: jakejarvis/[email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toCurry = function (func) { | |
return function (val) { | |
func(val); | |
} | |
}; | |
toCurry(console.warn)('sdfsdf'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stripe.subscriptions.create({ | |
customer: "your-customers-id", | |
plan: "monthly-membership", | |
application_fee_percent: 5 | |
}, { | |
stripe_account: req.body.account | |
}) |