I hereby claim:
- I am colelawrence on github.
- I am colelawr (https://keybase.io/colelawr) on keybase.
- I have a public key whose fingerprint is 8370 0CDE B75E 31F7 7605 4CF5 0D82 40E5 138C 1DB1
To claim this, I am signing this object:
| #load "GetStarted1.fs" | |
| open GetStarted1 | |
| // https://fsharpforfunandprofit.com/posts/control-flow-expressions/ | |
| // https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tour#pipelines-and-composition | |
| // Pattern matching examples | |
| let a,b = 1,2 | |
| type Person = {First:string; Last:string} |
I hereby claim:
To claim this, I am signing this object:
| func randAlphanum() byte { | |
| // >>> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<<< | |
| // lowercase 97...122 = 26 | |
| // uppercase 65...90 = 26 | |
| // numerals 48...57 = 10 | |
| // lowercase 0...25, + 97 | |
| // uppercase 26...51, + 39 | |
| // numerals 52...61, - 4 | |
| var val = rand.Intn(62) | |
| if val >= 52 { |
| -- Voice recognizer | |
| -- `_ speaking is heard _` | |
| When /person/ speaking is heard /speech/: | |
| -- word { confidence, lowercase, pauses_after } | |
| local words = identify(speech) | |
| -- `_ was asked if they meant _ of _` | |
| When (person) was asked if they meant /option index/ of /possible_choices/, | |
| -- `_ as _ is _` | |
| /yes_or_no/ as (nlp_yes_no(words)) is (not_nil): |
| onScroll(window, (scrollX, scrollY) => { | |
| log({ scrollX, scrollY }) | |
| }) | |
| function onScroll(target: HTMLElement, fn) { | |
| const onscroll = (_evt) => fn(target.scrollX, target.scrollY); | |
| if (supportsPassive()) { | |
| target.addEventListener("scroll", onscroll, { passive: true }) | |
| } else { |
| const log = console.log.bind(console); | |
| const elts = [].slice.call(document.getElementsByClassName("siv")); | |
| elts.forEach(elt => elt.classList.add("siv-enabled")); | |
| elts.forEach(elt => log(elt, { offset: getOffset(elt) })); | |
| onScroll(window, (scrollX, scrollY) => { | |
| elts.forEach(elt => { | |
| const top = getOffset(elt).top; |
| type Combinator = string | RegExp | any; | |
| type Previous = { | |
| members: RuleMember[]; | |
| }; | |
| type RuleMember = { name: string }; | |
| /** | |
| * Every grammar rule is written as a JavaScript function that takes a parameter conventionally called $. The syntax $.identifier is how you refer to another grammar symbol within a rule. |
| /** | |
| * Get a single readable and writable value which is persisted into IndexedDB | |
| * @template T | |
| * @param {IDBDatabase | PromiseLike<IDBDatabase>} db | |
| * @param {T} init is used if value does not exist | |
| * @returns {Promise<{ | |
| * get: () => Promise<T>, | |
| * set: (value: T) => Promise<void>, | |
| * }>} promise of savable value |
| const init = Symbol(); | |
| const error = Symbol(); | |
| /** | |
| * Stream can be thought of like a Promise which can be resolved multiple times. | |
| * Also, a stream does not have a separate channel for errors. | |
| */ | |
| export class Stream<T> { | |
| private listeners = new Set< | |
| [(addValue: T) => any, (rejectError: any) => any] |
| type LanguageKey = keyof Definitions<any> | |
| let currentLanguage: LanguageKey = "en" | |
| /** | |
| * @param namespace most underlying i18n solutions like to have a namespace | |
| */ | |
| function define<T>(namespace: string, definitions: Definitions<T>): Translate<T> { | |
| // ... set up with your existing translation library which supports fallbacks and such... | |
| return key => `Key (${key}) has no definition` |