Skip to content

Instantly share code, notes, and snippets.

main : Signal Html
main =
Signal.map (view actions.address) (model getStorage)
@rogeriochaves
rogeriochaves / brunch-config.coffee
Last active June 16, 2017 10:38
Brunch vs Webpack
exports.config =
files:
javascripts:
joinTo: 'app.js'
stylesheets:
joinTo: 'app.css'
port setData : Signal Data.Model
incommingData : Signal Action.Action
incommingData =
Signal.map UpdateData setData
-- App starting
app : StartApp.App Model
main =
ul [class "grocery-list"]
[ li [] [text "Pamplemousse"]
, li [] [text "Ananas"]
, li [] [text "Jus d'orange"]
, li [] [text "Boeuf"]
, li [] [text "Soupe du jour"]
, li [] [text "Camembert"]
, li [] [text "Jacques Cousteau"]
, li [] [text "Baguette"]
module Main where
type alias Animal = { name : String, sayHello : String } -- class
animal : String -> Animal -- object creator
animal name =
{ name = name
, sayHello = Debug.crash <| "Missing implementation"
}
type alias Cat = Animal
-- Interface
class AnimalInterface a where
name :: a -> String
sayHelloTo :: a -> String -> String
-- Dog Implementation
data Dog = Dog
{ dogName :: String
}

Keybase proof

I hereby claim:

  • I am rogeriochaves on github.
  • I am rchaves (https://keybase.io/rchaves) on keybase.
  • I have a public key whose fingerprint is 3A4B 298F E312 443C 15D9 EE29 E6AF 5440 509B 1D94

To claim this, I am signing this object:

all : Test
all =
describe "Fuzz Sample Test Suite"
[ describe "Fuzz test examples, using randomly generated input"
[ fuzz (list int) "Lists always have positive length" <|
\aList ->
List.length aList |> Expect.atLeast 0
, fuzz (list int) "Sorting a list does not change its length" <|
\aList ->
List.sort aList |> List.length |> Expect.equal (List.length aList)
<html>
<head>
<title>Microfrontends!</title>
</head>
<body>
<async-component url="header"></async-component>
<async-component url="content"></async-component>
<async-component url="footer"></async-component>
<script>
function loadPage (element) {
@rogeriochaves
rogeriochaves / export.js
Created December 30, 2016 17:23
export mosaico.io template
const exportTemplate = () => {
const id = window.location.hash.replace('#', '');
return `
localStorage.setItem('edits', (localStorage.getItem('edits') || []).concat(['${id}']));
localStorage.setItem('metadata-${id}', '${localStorage.getItem('metadata-' + id).replace(/\\/g, '\\\\')}');
localStorage.setItem('template-${id}', '${localStorage.getItem('template-' + id).replace(/\\/g, '\\\\')}');
window.location = 'https://mosaico.io/editor.html?0.15#${id}';
`
};