Skip to content

Instantly share code, notes, and snippets.

View girishso's full-sized avatar

Girish Sonawane girishso

  • Pune, India
View GitHub Profile
@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
@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 / 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 / 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 / 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"
]
# Sublime Text 3
** By: Girish Sonawane**
## Why Sublime Text?
## Navigation
⌘ + P / ⌘ + T
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 }
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.
#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
@girishso
girishso / esakal.sh
Created January 11, 2016 06:54
Little script that runs every morning on my raspberry pi and emails me the movies page from esakal!
#!/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