Skip to content

Instantly share code, notes, and snippets.

@pdamoc
pdamoc / CounterList.elm
Created August 30, 2016 07:36
CounterList Example without nesting.
module Main exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
main =
App.beginnerProgram
@mkulke
mkulke / Main.elm
Created January 23, 2016 09:59
Elm: simple rest call
module Main where
import Html exposing (Html, text, p)
import Signal exposing (Address)
import Effects exposing (Effects, Never)
import Json.Decode as Json exposing ((:=))
import StartApp exposing (start)
import Task
import Http
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

/* global window */
function StageResizer (stageElement, options) {
options = options || {};
this._element = stageElement;
this._stageWidth = options.stageWidth || stageElement.offsetWidth || 1;
this._stageHeight = options.stageWidth || stageElement.offsetWidth || 1;
this._snapToEdge = options.snapToEdge || true;
@TheSeamau5
TheSeamau5 / IsometricBoard.elm
Last active December 29, 2015 21:52
How to make a simple isometric 2D Board in Elm
------------------------------------------------
-- 2D Point Type
type Point = {
x : Float,
y : Float
}
-- Convert Point to a tuple of floats
toTuple : Point -> (Float, Float)
toTuple point = (point.x, point.y)
@shamansir
shamansir / gist:3007244
Created June 27, 2012 22:21
Test If Two Rotating Rectangles Intersect (SAT, JS)
// Excerpt from: https://github.com/Animatron/player/blob/master/anm.collisions.js
function edgeTest(p1, p2, p3, r2) {
var rot = [ -(p2[1] - p1[1]),
p2[0] - p1[0] ];
var ref = (rot[0] * (p3[0] - p1[0]) +
rot[1] * (p3[1] - p1[1])) >= 0;
for (var i = 0, il = r2.length; i < il; i+=2) {