Skip to content

Instantly share code, notes, and snippets.

@masonjeffreys
masonjeffreys / TopicView.elm
Created Oct 27, 2017
File Upload Elm 0.18
View TopicView.elm
-- Important parts of file upload through a HTTP Post form in Elm
-- This example reflects an application like a Facebook Post Feed
-- Each post has a comment form at the bottom of the post
-- A comment can be text or attaching a photo
module TopicView exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
@evancz
evancz / data-interchange.md
Last active Dec 8, 2020
Why do I have to write JSON decoders in Elm?
View data-interchange.md

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

View cijoe-repos_build-hooks
#!/bin/bash
FULLPATH=`cd $(dirname $0); pwd`
echo $FULLPATH >&2
PROJECT=`echo $FULLPATH | awk -F/ '{print $(NF-3)}'`
STATUS=`echo $0 | awk -F- '{print $NF == "worked" ? "pass" : ($NF == "reset" ? "building" : "fail")}'`
PW=`cat $FULLPATH/../../../../credentials`
curl -u $PW -d"author=$AUTHOR" -- http://ci.domain.com/dashboard/build/$PROJECT/$STATUS
echo "Project: "$PROJECT", Status: "$STATUS", Fullpath: "$FULLPATH >&2
You can’t perform that action at this time.