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 Html.App exposing (beginnerProgram) | |
import Html.Events exposing (onClick) | |
import Date exposing (Date) | |
import Html exposing (..) | |
import Json.Decode as Js exposing ((:=)) | |
main = | |
beginnerProgram { model = 0, view = view, update = update } |
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
# Sublime Text 3 | |
** By: Girish Sonawane** | |
## Why Sublime Text? | |
## Navigation | |
⌘ + P / ⌘ + T |
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
view : Model -> Html Msg | |
view model = | |
section [ class "section" ] | |
[ div [ class "container" ] | |
[ h1 [ class "title" ] | |
[ text model.projectName ] | |
, p [ class "subtitle" ] | |
[ button [ class "button", onClick TogglePopup ] | |
[ text "Show Popup" | |
] |
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 alias GameState = | |
{ board : Dict.Dict Position Cell | |
, currentPlayer : Player | |
} | |
type alias Cell = | |
{ pebble : Pebble | |
, noKill : Bool | |
, state : CellState | |
} |
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 alias CellWrapper = | |
{ pos : Position, cell : Cell } | |
{- | |
Corresponding JSON | |
{ | |
"board": [ | |
{ | |
"pos": [ 0, 0 ], | |
"cell": { "pebble": "Black", "noKill": false, "state": "Normal" } |
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
gameStateDecoder : Decode.Decoder GameState | |
gameStateDecoder = | |
Decode.map2 GameState | |
(field "board" boardDecoder) | |
(field "currentPlayer" playerDecoder) | |
gameStateEncoder : GameState -> Encode.Value | |
gameStateEncoder v = | |
Encode.object | |
[ ( "board", boardEncoder v.board ) |
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
boardDecoder : Decode.Decoder (Dict Position Cell) | |
boardDecoder = | |
let | |
asTuple : CellWrapper -> ( Position, Cell ) | |
asTuple cw = | |
( cw.pos, cw.cell ) | |
toDict : List CellWrapper -> Dict Position Cell | |
toDict wrappers = | |
wrappers |> List.map asTuple |> Dict.fromList |
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 BottomScroll exposing (main) | |
import InfiniteScroll as IS | |
import Html exposing (..) | |
import Html.Attributes exposing (style) | |
import Http | |
import Json.Decode as JD | |
type Msg |
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 (..) | |
import RemoteData exposing (WebData, RemoteData(..), asCmd, fromTask) | |
import Html exposing (Html, text, div, input, br) | |
import Html.Events exposing (onClick) | |
import Html.Attributes exposing (type_, value) | |
import Http exposing (get, toTask) | |
import Json.Decode exposing (Decoder, string) | |
import Json.Decode.Pipeline exposing (decode, required) | |
import Random exposing (int, generate) |
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 -I https://api.github.com/users/girishso/repos | |
. | |
. | |
Link: <https://api.github.com/user/35009/repos?page=2>; rel="next", <https://api.github.com/user/35009/repos?page=2>; rel="last" | |
. | |
. |