Skip to content

Instantly share code, notes, and snippets.

View austin-sa-wang's full-sized avatar

Austin Wang austin-sa-wang

View GitHub Profile
[
{
"codeName": "STUDENT",
"studentEnrollmentSections": [
{
"codeName": "STUDENT",
"studentEnrollmentFields": [
{
"codeName": "FIRSTNAME",
"placeholder": "PH_FIRSTNAME",
public async isValidEndDateFantasy (offeringId: number, endDate: string) {
// doLoadOffering :: number -> Promise(Either(AppError, Offering))
const loadOffering = new Task((reject, result) => {
this.Models.Offering.load(offeringId)
.then((offering) => {
if (isNil(offering)) {
return reject(new AppError(`OfferingId ${offeringId} did not correspond to an offering`))
}
return result(offering)
@austin-sa-wang
austin-sa-wang / onboardingWizardDesignByAustin.js
Last active April 7, 2020 08:47
onboarding wizard design for simplicity and flexbility
/**
* Simple wizard
* design philosophy: simplicity, wysiwyg, isolated responsibilities
* key design decision: each wizard step is aware that it's part of a wizard
* upside: simple and flexible
* downside: more boilerplate
* case-by-case: when we need to add or rearrange the steps, we also need to modify existing steps (smell: Shotgun Surgery)
* however, this is aligned with the key design decision
*
* alternative key design: opposite - isolated steps that are unaware of the fact that they're part of a wizard
@austin-sa-wang
austin-sa-wang / gist:0936d377bc7da0b0a6a7fb60ccd7e5d0
Last active March 4, 2019 23:24
Dependency Inversion Example
type IApplicableFeeMap = Map<string, IApplicableFee>
class ApplicableFeesCooridinator {
protected applicableFees: IApplicableFee[]
constructor(protected Models: IModels, prices: IOfferingPriceDerivedBase[]) {
...
this.applicableFees = this.generateApplicableFees(prices)
}
@austin-sa-wang
austin-sa-wang / gist:5fbd6e1cf35812e4ddf5c04ba170b338
Created November 29, 2018 19:59
Create student quote new input example
mutation createQuote {
createStudentQuote(input: {
studentId: 153254,
languageId: 1,
studentQuoteOptions: {
priceCurrencyId: 26,
studentQuoteOptionCourseItems: [{
offeringId: 5666,
startDate: "2018-12-02",
durationAmount: 4,
@austin-sa-wang
austin-sa-wang / a.js
Created November 15, 2018 19:36
serialization different function formation
const serializeOfferingOptions = R.map(R.compose(
R.pick([
'offeringOptions',
'offeringId',
'offeringPackageOptionId',
'durationAmount',
'durationTypeId',
'startDate',
'selectedPackageOptionItems'
]),
@austin-sa-wang
austin-sa-wang / abc.md
Created October 24, 2018 22:20
FE Endpoint Usage for A List of Endpoints of interest (https://edvisorio.atlassian.net/browse/ES-101)
  • GET /offering/count
  • GET /offering/findOne
  • GET /offering/start-date-from-range
  • GET /offering-course
  • GET /offering-course/count
  • POST /offering-course/update
  • GET /offering-course/findOne
  • GET /offering-course/list
  • GET /offering-accommodation/count
  • GET /offering-accommodation/findOne
@austin-sa-wang
austin-sa-wang / manageVariationList.js
Last active September 10, 2018 22:28
Compare different organization
/*
Background:
We have a component with two buttons, one button for adding a new empty fee variation, another for duplicating an existing fee variation.
for example:
button(click='uiModel.addVariation()') Add New
button(click='uiModel.duplicateVariation(seed)') Duplicate
There are four different implementations: