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 Main exposing (main) | |
import Html exposing (Html) | |
import Html.Events as Events exposing (onClick) | |
import Http | |
import Json.Decode as Decode exposing (Decoder, Value) | |
type CounterState | |
= CounterState |
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
norpan [1:21 PM] | |
Hey, I was just thinking about the `Cmd` being returned from the `init` and `update` functions. I’ve never really liked that, so I was just wondering if anybody else has toyed with the idea to instead return a `List Command` or similar where you’d define your `Command`s just like you define your `Msg`s and then only at the last moment convert them to `Cmd`s? | |
ilias [1:25 PM] | |
Luke is doing something like that, or experimenting with it | |
opsb [1:25 PM] | |
@norpan I have an `AppCmd msg` which only gets converted to `Cmd`s as late as possible. It implements the same API as Cmd, `AppCmd.batch, AppCmd.none etc.` but it allows me to have a lot more control when testing for instance. (edited) | |
norpan [1:25 PM] | |
exactly, that’s my thinking too | |
opsb [1:26 PM] | |
It also makes it easier to have commands like `AppCmd.logout` |
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
port module Main exposing (main) | |
import Html exposing (Html) | |
import Html.Events as Events exposing (onWithOptions) | |
import Json.Decode as Decode exposing (Value) | |
port saveToClipboard : Value -> Cmd msg | |
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
port module Main exposing (main) | |
import Html exposing (Html) | |
import Html.Events exposing (onClick) | |
import Http | |
import Json.Decode as Decode exposing (Decoder, Value) | |
import Json.Encode as Encode | |
port toElm : (Value -> msg) -> Sub msg |
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 ElmFxAndCmds exposing (main) | |
import Html exposing (Html) | |
import Html.Events exposing (onClick) | |
import Http | |
import Json.Decode as Decode exposing (Decoder, Value) | |
type alias Model = | |
{} |
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
port module FromReduxToElm exposing (main) | |
import Html exposing (Html) | |
port sayHello : (String -> msg) -> Sub msg | |
type alias Model = | |
{ who : 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
-- From https://robots.thoughtbot.com/5-common-json-decoders#1---decoding-union-types | |
fromResult : Result String a -> Decoder a | |
fromResult result = | |
case result of | |
Ok a -> JD.succeed a | |
Err errorMessage -> JD.fail errorMessage | |
parseDirection : String -> Result String Direction |
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
port module Main exposing (main) | |
import Html exposing (Html) | |
port fromElm : String -> Cmd msg | |
port toElm : (String -> msg) -> Sub msg |
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
port module ElmFsaPorts exposing (main) | |
import Html exposing (Html, text) | |
import Json.Decode as Decode exposing (Decoder, Value) | |
import Json.Encode as Encode | |
port fromElm : Value -> Cmd msg | |
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
* autojump - bookmark console | |
* mosh - mobileshell | |
* sshuttle - easy vpn with python? | |
* ripgrep (rg) - better silversurfer (ag) | |
* https://github.com/asdf-vm/asdf | |
* https://github.com/junegunn/fzf | |
* https://github.com/abo-abo/swiper | |
Tasks |