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
case pet of | |
Fish fish -> fish.swim | |
Bird bird -> bird.fly |
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
a = 1; | |
a = a + 2; | |
a = a * 3; // Gives 9 | |
// while, inverting the order of | |
// the 2nd and 3rd line: | |
a = 1; | |
a = a * 3; | |
a = a + 2; // Gives 5 |
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
if (isFish(pet)) { | |
pet.swim(); | |
} else { | |
pet.fly(); | |
} |
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
function isFish(pet: Fish | Bird): pet is Fish { | |
return (pet as Fish).swim !== undefined; | |
} |
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 Form.Example exposing (..) | |
import Form.Key | |
type alias ValidationMessage = | |
String | |
type alias EntityId = |
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 Main exposing (main) | |
import Browser | |
import Html exposing (..) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
init = { a = "1", b = "2" } | |
type Msg = ChangeA String | ChangeB String |
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
const chalk = require('chalk') | |
logoElm = [ | |
'ggggcccc', | |
'bggggccc', | |
'bboooocc', | |
'bbbooggc', | |
'bbbxgggo', | |
'bbxccgoo', | |
'bxccccoo', |
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
#!/usr/local/bin/node | |
// From a gist of Jinjor: https://gist.github.com/jinjor/cce51986afa422a3e38befebe091ead2 | |
const fs = require("fs"); | |
const childProcess = require("child_process"); | |
childProcess.exec("./node_modules/.bin/elm-analyse", (e, out) => { | |
let file; | |
let unusedImports = {}; | |
let unusedAliases = {}; | |
for (let line of out.split("\n")) { |
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
<div id="app"> | |
<div v-for="product in products"> | |
<input type="number" v-model="product.quantity"> | |
<button @click="product.quantity += 1"> | |
Add 1 | |
</button> | |
{{ product.name }} | |
</div> | |
<p>Total Inventory: {{ totalProducts }}</p> | |
<p>Quantities: {{products.map(function(p){return p.quantity})}}</p> |
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
<div id="app"></div> | |
<script src="js/elm.v.1.js"></script> | |
<script> | |
Elm.Main.init({ | |
node: document.getElementById("app"), | |
flags: { | |
url: "https://api.myjson.com/bins/74l63" | |
} | |
}); | |
</script> |