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 State<s, a> = (state: s) => [s, a] | |
function pureState<s, a> (a: a): State<s, a | null> { | |
return (s: s) => [s, a] | |
} | |
function mapState<s, a1, a2> (fn: (action: a1) => a2 | null, state: State<s, a1 | null>): State<s, a2 | null> { | |
return (s) => { | |
const [nextState, action] = state(s) | |
if (action !== null) return [nextState, fn(action)] |
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
(ns app.main | |
(:import | |
[javax.servlet.http HttpServletResponse HttpServletRequest] | |
[org.eclipse.jetty.server Request ServerConnector Server] | |
[org.eclipse.jetty.server.handler AbstractHandler] | |
[org.eclipse.jetty.util.thread QueuedThreadPool]) | |
(:gen-class)) | |
(defn handler [^HttpServletRequest _ ^HttpServletResponse response] | |
(let [writer (.getWriter (doto response |
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
module ShipData exposing (..) | |
type Size | |
= Small | |
| Medium | |
| Large | |
| Huge | |
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
module GenerateShipData exposing (..) | |
import Elm exposing (Expression) | |
import Gen.ShipData | |
import Json.Decode as Decode exposing (Decoder) | |
import ShipData | |
exposing | |
( Attack | |
, AttackProfile | |
, DefenseToken(..) |
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
vim.cmd [[packadd packer.nvim]] | |
vim.bo.omnifunc = 'v:lua.vim.lsp.omnifunc' | |
local o = vim.o | |
o.expandtab = true | |
o.smartindent = true | |
o.tabstop = 2 | |
o.shiftwidth = 2 |
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 Prelude | |
import Control.Monad.Maybe.Trans (MaybeT(..), runMaybeT) | |
import Control.Monad.Trans.Class (lift) | |
import Data.Maybe (Maybe(..), maybe) | |
import Data.Maybe as Maybe | |
import Data.Newtype (wrap) | |
import Data.String as String | |
import Effect (Effect) | |
import Web.DOM.Node (Node) | |
import Web.DOM.Node as Node |
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 t<'res, 'err> = Future('res, 'err) | |
type cancel = unit => unit | |
// Creation | |
@module("fluture") | |
external future: (('res => unit, 'err => unit) => cancel) => t<'res, 'err> = "Future" | |
let resolve = a => | |
future((res, _rej) => { |
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/sh | |
set -e | |
js="bundle.js" | |
min="bundle.min.js" | |
elm make --optimize --output=$js src/Main.elm | |
./node_modules/.bin/uglifyjs $js --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' | ./node_modules/.bin/uglifyjs --mangle --output $min |
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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TupleSections #-} | |
module Main where | |
import qualified Text.ParserCombinators.Parsec as P | |
type Input = [Int] | |
data ProcessTree = ProcessTree |
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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TupleSections #-} | |
module Main where | |
import Text.ParserCombinators.Parsec as P | |
data Program = Program {total :: Int, visited :: [Int], lastToggle :: Int} deriving (Show) | |
type InputLine = (String, Int) |
NewerOlder