Last active
September 9, 2017 15:12
-
-
Save thotmx/f0b0a1b5b97ccb4d8f301d482a366fb8 to your computer and use it in GitHub Desktop.
Revisions
-
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,9 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) import Html.Events exposing(onInput, onClick) import Random exposing (..) import Random.String import Random.Char type alias Model = { content : String @@ -13,16 +16,25 @@ initialModel = { content = "Hola" } -- UPDATE type Msg = Update String | Reset update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of Reset -> ( { model | content = "" } , generateRandomString) Update newString -> ( { model | content = newString }, Cmd.none) -- COMMANDS generateRandomString : Cmd Msg generateRandomString = Random.generate Update (Random.String.string 5 Random.Char.english) -- VIEW view model = div [] [ input [ placeholder "Escribe algo", onInput Update ] [] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,20 +8,20 @@ type alias Model = { -- MODEL initialModel : Model initialModel = { content = "Hola" } -- UPDATE type Msg = Update String | Reset update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of Reset -> ( { model | content = "Hola" } , Cmd.none ) Update newString -> ( { model | content = newString }, Cmd.none) -- VIEW view model = div [] [ @@ -31,8 +31,9 @@ view model = div [] [ ] -- MAIN main = program { init = ( initialModel, Cmd.none) , update = update , view = view , subscriptions = ( \_ -> Sub.none ) } -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) import Html.Events exposing(onInput, onClick) type alias Model = { content : String @@ -13,18 +13,21 @@ model = { content = "Hola" } -- UPDATE type Msg = Update String | Reset update : Msg -> Model -> Model update msg model = case msg of Reset -> { model | content = "Hola" } Update newString -> { model | content = newString } -- VIEW view model = div [] [ input [ placeholder "Escribe algo", onInput Update ] [] , h1 [] [ text model.content ] , button [onClick Reset] [ text "Reset" ] ] -- MAIN -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,11 +23,12 @@ update msg model = -- VIEW view model = div [] [ input [ placeholder "Escribe algo", onInput Update ] [] , h1 [] [ text model.content ] ] -- MAIN main = beginnerProgram { model = model , update = update , view = view -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ update msg model = -- VIEW view model = div [] [ input [ placeholder "Escribe algo", onInput (\inputString -> Update ("..." ++ inputString ++ "...")) ] [] , h1 [] [ text model.content ] ] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -27,4 +27,8 @@ view model = div [] [ , h1 [] [ text model.content ] ] main = Html.beginnerProgram { model = model , update = update , view = view } -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) import Html.Events exposing(onInput) type alias Model = { content : String @@ -22,7 +23,7 @@ update msg model = -- VIEW view model = div [] [ input [ placeholder "Escribe algo", onInput (\inputString -> Update inputString) ] [] , h1 [] [ text model.content ] ] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,12 @@ model = { content = "Hola" } type Msg = Update String update : Msg -> Model -> Model update msg model = case msg of Update newString -> { model | content = newString } -- VIEW view model = div [] [ input [ placeholder "Escribe algo"] [] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,8 @@ model = { content = "Hola" } -- UPDATE type Msg = Update String -- VIEW view model = div [] [ input [ placeholder "Escribe algo"] [] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,14 @@ type alias Model = { content : String } -- MODEL model : Model model = { content = "Hola" } -- UPDATE -- VIEW view model = div [] [ input [ placeholder "Escribe algo"] [] , h1 [] [ text model.content ] -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 7 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,16 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) type alias Model = { content : String } model : Model model = { content = "Hola" } view model = div [] [ input [ placeholder "Escribe algo"] [] , h1 [] [ text model.content ] ] main = view model -
thotmx revised this gist
Sep 9, 2017 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) model = "Hola" view model = div [] [ input [ placeholder "Escribe algo"] [] , h1 [] [ text model ] ] main = view model -
thotmx revised this gist
Sep 8, 2017 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ import Html exposing (..) import Html.Attributes exposing(placeholder) view = div [] [ input [ placeholder "Hey"] [] ] main = view -
thotmx revised this gist
Sep 8, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ import Html exposing (..) view = Html.text "Hello world" main = view -
thotmx created this gist
Sep 8, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ import Html exposing (..) main = Html.text "Hello world"