This file contains 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 omitMaybeUndefined: Js.Json.t => Js.Json.t = %raw( | |
"function(obj) {Object.keys(obj).forEach(key => obj[key] === 'UNDEFINED' ? delete obj[key] : {}); return obj;}" | |
) | |
%%raw(` | |
let _omitMaybeUndefinedRecursive = (obj) => { | |
let newObj = {}; | |
Object.keys(obj).forEach((key) => { | |
if (obj[key] === Object(obj[key])) newObj[key] = _omitMaybeUndefinedRecursive(obj[key]); |
This file contains 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
document.addEventListener("DOMContentLoaded", (event) => { | |
function handleElementAppeared(textarea) { | |
console.log(textarea); | |
textarea.addEventListener("keydown", e => { | |
if (e.key === "Enter") { | |
var stopButton = document.querySelector('[aria-label="Stop generating"]'); | |
if (stopButton) { | |
stopButton.click(); | |
textarea.submit(); | |
} |
This file contains 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 key = string; | |
type rs; | |
type options = {auth: string}; | |
[@bs.module "@roomservice/browser"] [@bs.new] | |
external make: options => rs = "RoomService"; | |
type room; | |
[@bs.send] external room: (rs, string) => Js.Promise.t(room) = "room"; |
This file contains 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
// original source code at https://github.com/sdoomz/react-google-picker/blob/master/src/react-google-picker.js | |
import React, { useEffect } from "react"; | |
import PropTypes from "prop-types"; | |
import loadScript from "load-script"; | |
const GOOGLE_SDK_URL = "https://apis.google.com/js/client.js"; | |
let scriptLoadingStarted = false; | |
export const request = (url) => { |
This file contains 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
/* Global settings */ | |
[@bs.deriving abstract] | |
type pixiSettings = { | |
[@bs.as "ROUND_PIXELS"] | |
mutable roundPixels: bool, | |
[@bs.as "MIPMAP_TEXTURES"] | |
mutable mipMapTextures: int, | |
[@bs.as "PRECISION_FRAGMENT"] | |
mutable precisionFragment: string, | |
}; |
This file contains 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 Menu = { | |
[@bs.module "@reach/menu-button"] [@react.component] | |
external make: | |
(~className: string=?, ~children: React.element) => React.element = | |
"Menu"; | |
module Button = { | |
[@bs.module "@reach/menu-button"] [@react.component] | |
external make: (~children: React.element) => React.element = "MenuButton"; | |
}; |
This file contains 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
/* Hooks.re */ | |
let useMachine = (initialState, initialContext, decisionTree) => { | |
let (state, setState) = React.useState(_ => initialState); | |
let (context, setContext) = React.useState(_ => initialContext); | |
let transition = event => | |
setState(state => decisionTree(event, state, setContext)); | |
(state, context, transition); | |
}; |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
NewerOlder