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
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 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 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 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 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 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 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 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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
# Activate the gem you are reporting the issue against. |
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
#define HC_DATA_H digitalWrite(data, HIGH) // data line output high | |
#define HC_DATA_L digitalWrite(data, LOW) //date line output low | |
#define HC_RCK_H digitalWrite(rck, HIGH) // rck output high | |
#define HC_RCK_L digitalWrite(rck, LOW) // rck output low | |
#define HC_SCK_H digitalWrite(sck, HIGH) // sck output high | |
#define HC_SCK_L digitalWrite(sck, LOW) // sck output low | |
unsigned char LED_BCD[16] ={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e }; //common anode digital tube BCD code |
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
#!/bin/bash | |
link="http://epaper3.esakal.com/%s/Enlarge/PuneCity/Pune1Today/page%s.htm" | |
html_file7="/var/log/esakal.htm7" | |
html_file8="/var/log/esakal.htm8" | |
url="" | |
# cf. "Editing files with the ed text editor from scripts.", | |
# http://wiki.bash-hackers.org/doku.php?id=howto:edit-ed |