Skip to content

Instantly share code, notes, and snippets.

View girishso's full-sized avatar

Girish Sonawane girishso

  • Pune, India
View GitHub Profile
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 }
# Sublime Text 3
** By: Girish Sonawane**
## Why Sublime Text?
## Navigation
⌘ + P / ⌘ + T
@girishso
girishso / View.elm
Last active December 28, 2017 02:20
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"
]
@girishso
girishso / GameState.elm
Last active April 9, 2018 06:13
GameState.elm
type alias GameState =
{ board : Dict.Dict Position Cell
, currentPlayer : Player
}
type alias Cell =
{ pebble : Pebble
, noKill : Bool
, state : CellState
@girishso
girishso / CellWrapper.elm
Last active April 11, 2018 06:38
CellWrapper
type alias CellWrapper =
{ pos : Position, cell : Cell } 
{-
Corresponding JSON
{
"board": [
{
"pos": [ 0, 0 ],
"cell": { "pebble": "Black", "noKill": false, "state": "Normal" }
@girishso
girishso / Model.elm
Last active April 10, 2018 06:58
gameStateDecoder.elm
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 )
@girishso
girishso / Model.elm
Last active April 10, 2018 07:01
decoders.elm
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
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
@girishso
girishso / Main.elm
Created August 11, 2018 15:09 — forked from mdemin914/Main.elm
example of fetching data with elm and remote data
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)
> 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"
.
.