Here is some of the stuff I did over the years
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
{- | |
I got frustrated about how Http.get works, so I expanded all the function in Elm core to get to the bottom of line | |
-} | |
expectJson : (Result Error a -> msg) -> Decode.Decoder a -> Expect msg | |
expectJson toMsg decoder = | |
let | |
decodingResult string = | |
case (Decode.decodeString decoder string) of | |
Ok v -> | |
Ok v |
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 Main exposing (..) | |
-- This code needs following dependencies: | |
-- elm/browser 1.0.2 | |
-- elm/html 1.0.0 | |
-- elm/http 2.0.0 | |
-- elm/json 1.1.3 | |
-- elm/random 1.0.0 | |
-- krisajenkins/remotedata 6.0.1 | |
-- NoRedInk/elm-json-decode-pipeline/ 1.0.1 | |
-- Can try it here: https://ellie-app.com/nBCdHpv2jRta1 |
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 Main exposing (..) | |
type alias Bar = | |
{ baz : String } | |
type alias Foo = | |
{ bar : Bar } |
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 { createFactory, Component } from 'react' | |
export const withContext = (childContextTypes, getChildContext) => BaseComponent => { | |
const factory = createFactory(BaseComponent) | |
class WithContext extends Component { | |
getChildContext = () => getChildContext(this.props) | |
render() { | |
return factory(this.props) | |
} |
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
curl -s https://api.github.com/repos/roc-lang/roc/releases|jq -r '.[0].assets [0].browser_download_url'|xargs -n1 -I % curl -L % --output roc_nightly.tar.gz |
based on https://www.reddit.com/r/vim/comments/24g8r8/italics_in_terminal_vim_and_tmux/
- Check if italic font is supported:
$ echo -e "\e[3mitalic\e[23m"
- Also check:
$ infocmp $TERM | grep sitm
sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h,
Solution to https://twitter.com/nolanlawson/status/578948854411878400.
doSomething().then(function () {
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 Hook = {| | |
memoizedState: any, | |
queue: UpdateQueue < any > | null, | |
next: Hook | null, | |
|}; | |
*/ | |
// Whether the work-in-progress hook is a re-rendered hook | |
let numberOfReRenders/*: number */= 0; | |
let isReRender/*: boolean */= false; | |
let firstWorkInProgressHook /*Hook | null */= null; |