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
// Collection (in state) | |
{ | |
// We've married the config and collections objects | |
// here, as the fact that they're separated is not relevant | |
// to the module | |
displayName: name, | |
lastModifyBy: Reetta | |
live: [{ | |
// There's some nesting here - we're unsure how we'd manage |
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
// @ts-check | |
const levenshtein = require("fast-levenshtein"); | |
const crypto = require("crypto"); | |
const traceHashMap = {}; | |
const trace = n => { | |
const hash = crypto.createHash("sha1"); | |
hash.update(n.toString()); |
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
// in ApiController body | |
def checkStream: WebSocket = WebSocket.accept[JsValue, JsValue] { _ => | |
ActorFlow.actorRef(out => | |
CheckStreamActor.props(out, matcherPool) | |
, | |
// A large buffer is necessary to ensure messages aren't dropped -- see | |
// https://github.com/playframework/playframework/issues/6246. | |
10000) | |
} |
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
lazy val adminToolsLib = project("admin-tools-lib", Some("admin-tools/lib")) | |
.settings( | |
excludeDependencies ++= Seq( | |
ExclusionRule("org.elasticsearch"), | |
ExclusionRule("com.sksamuel.elastic4s"), | |
ExclusionRule("com.drewnoakes", "metadata-extractor"), | |
ExclusionRule("org.codehaus.janino"), | |
ExclusionRule("com.typesafe.play"), | |
ExclusionRule("org.scalaz.stream"), | |
ExclusionRule("org.im4java"), |
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
"use strict"; | |
class ExampleAsyncService { | |
currentSearch = undefined; | |
search(searchTerms) { | |
this.currentSearch = searchTerms; | |
console.log(`Searching for ${searchTerms}`); |
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 Fields = Record<string, number> | |
type Obj<ObjKey extends string, ObjVals extends Fields> = { [key in ObjKey]: ObjVals } | |
const obj = { "A": { fieldOne: 1 }, "B": { fieldTwo: 2 } } | |
const acceptsObj = <TKeys extends string, TFields extends Fields>(obj: Obj<TKeys, TFields>) => { | |
return <Key extends TKeys>(key: Key, fields: Obj<TKeys, TFields>[Key]) => undefined; | |
} | |
const fn = acceptsObj(obj) |
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
https://glitch.com/edit/#!/busy-loving-snagglefoot?path=index.html%3A31%3A0 |
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
const episodeList = [{ | |
name: 'A great show', | |
season: 1, | |
summary: '<p>Seriously, really good', | |
image: 'https://an-image/img.jpg' | |
}, | |
{ | |
name: 'Another great show', | |
season: 2, |
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
object ExampleObj { | |
val getFirstThing: () => Either[Throwable, String] = () => Left(new Exception("dsa")) | |
val getSecondThing: () => Either[Throwable, String] = () => Right("second thing") | |
val getThirdThing: () => Either[Throwable, String] = () => Right("third thing") | |
val result = getFirstThing().flatMap(firstThing => { | |
getSecondThing().flatMap(secondThing => { | |
getThirdThing().flatMap(thirdThing => { | |
Right(thirdThing) | |
}) |
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
fbr() { | |
local branches branch | |
branches=$(git reflog show --pretty=format:'%gs ~ %gd' --date=relative \ | |
| grep 'checkout:' \ | |
| grep -oE '[^ ]+ ~ .*' \ | |
| awk -F~ '!seen[$1]++' \ | |
| head -n 20 \ | |
| awk -F' ~ HEAD@{' '{printf(" \033[33m%s: \033[37m %s\033[0m\n", substr($2, 1, length($2)-1), $1)}' \ | |
| nl \ | |
| sort -nr \ |