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 { | |
| useReducerWithEffects, | |
| // hand-wavey, but meant to be used by React to create something | |
| // external will produce async values sent to components | |
| createEffect | |
| } from 'react'; | |
| function fetchUserEffect(id, parentRef) { | |
| const controller = new AbortController(); | |
| const signal = controller.signal; |
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 R = require('ramda'); | |
| const aws = require("aws-sdk"); | |
| const { GraphQLClient } = require("graphql-request"); | |
| aws.config.update({ | |
| region: process.env.REGION | |
| }); | |
| const cognitoidentityserviceprovider = new aws.CognitoIdentityServiceProvider({ | |
| apiVersion: "2016-04-18" | |
| }); |
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 https = require('https'); | |
| const AWS = require("aws-sdk"); | |
| const urlParse = require("url").URL; | |
| const appsyncUrl = process.env.API_BACKENDGRAPHQL_GRAPHQLAPIENDPOINTOUTPUT; | |
| const region = process.env.REGION; | |
| const endpoint = new urlParse(appsyncUrl).hostname.toString(); | |
| const graphqlQuery = require('./query.js').mutation; | |
| const apiKey = process.env.API_KEY; | |
| exports.handler = async (event) => { |
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
| let all = Js.Promise.all; | |
| let resolve = Js.Promise.resolve; | |
| let reject = Js.Promise.reject; | |
| let andThen = | |
| (p: Js.Promise.t('a), fn: 'a => Js.Promise.t('b)): Js.Promise.t('b) => | |
| p->Js.Promise.then_(fn, _); |
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
| PageModule.fetchModule("./MyComponent") | |
| |> Js.Promise.then_(m => send(SetRootElement(m()))); |
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 invalidMatchSignal = new Error(); | |
| function makeProxyThrower(input) { | |
| return new Proxy(input, { | |
| get(target, prop, receiver) { | |
| if (prop in target) { | |
| const result = Reflect.get(target, prop, receiver); | |
| if (typeof result === "object" && result !== null) { | |
| return makeProxyThrower(result); |
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
| type validation('a) = | |
| | NotEmpty | |
| | Custom('a); | |
| type t = string; | |
| let validate = (rule, value, values) => | |
| switch (rule) { | |
| | NotEmpty => String.length(value) > 0 | |
| | Custom(fn) => fn(value, values) |
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
| /* `action` and `state` types must be defined before the `let component` statement for type inference to work */ | |
| type action = | |
| | UpdateEmail string | |
| | UpdatePassword string; | |
| type state = { | |
| email: string, | |
| password: string | |
| }; |
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
| /** | |
| * Making promises | |
| */ | |
| let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
| /* Simpler promise creation for static values */ | |
| Js.Promise.resolve("easy"); | |
| Js.Promise.reject(Invalid_argument("too easy")); |
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
| module.exports = { | |
| use: [ | |
| 'autoprefixer', | |
| 'postcss-import', | |
| 'postcss-url', | |
| 'postcss-browser-reporter', | |
| 'postcss-reporter' | |
| ], | |
| input: 'index.css', | |
| output: 'dist/bundle.css', |
NewerOlder