Skip to content

Instantly share code, notes, and snippets.

@FruitieX
FruitieX / branching.md
Last active December 11, 2017 17:39
Cheat sheet for working with git branches

Branching workflow cheat sheet for git

Branching is useful when working on a larger project, and especially in our case where we have two git repositories. We have your team repository (origin in git terminology) and we have the Futurice repository (upstream in git terminology), and we wish to merge changes between these.

It makes sense to group each feature or bugfix into its own branch, which is like a copy of your entire project which later evolves with some changes (commits in git terminology). When you are done with your feature, you will request to merge all the commits in your branch to the upstream project with a 'pull request'. Here you get a chance to explain what changes have been done, and we

Hemmo Mobile API

This is documentation for the mobile-facing API.

Users are required to register before accessing API endpoints. However, after registration, the received token can be used indefinitely and should be stored client side. If the token is lost, re-registration is required.

User registration

Registers a new user to the service.

Hemmo Mobile API

This is documentation for the mobile-facing API.

Users are required to register before accessing API endpoints. However, after registration, the received token can be used indefinitely and should be stored client side. If the token is lost, re-registration is required.

User registration

Registers a new user to the service.

TOKEN=$(http POST localhost:3001/admin/users/authenticate email="foo@bar.com" password="foobar" | jq .token | tr -d '"')
CHILD_TOKEN=$(http POST localhost:3001/app/children Authorization:$TOKEN name=asdf | jq .token | tr -d '"')
FEEDBACK_ID=$(http POST localhost:3001/app/feedback Authorization:$CHILD_TOKEN | jq .id | tr -d '"')
http POST localhost:3001/app/content Authorization:$CHILD_TOKEN feedbackId=$FEEDBACK_ID questions:='[{"question": "Hello world?", "answer": "Hello!"}]'
@FruitieX
FruitieX / klockbadis-api.md
Last active November 9, 2017 12:30
Klockbadis api

Room setup

Player 1

  1. Open a websocket connection to server, gets auto-assigned to new room with random PIN.

    Reply:

rocket league input lag

wireless

  • x.48s -> x.56s = 0.08s
  • x.19s -> x.28s = 0.09s
  • x.90s -> x.99s = 0.09s
import Data.Foldable (all, elem)
type Field = String
type Config = Array Field
type RequiredFields = Array Field
fieldInConfig :: Config Field Boolean
fieldInConfig config field = elem field config
validateConfig :: Config RequiredFields Boolean
module Counter where
import Prelude hiding (apply)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Control.Monad.Eff.Ref (REF, Ref, modifyRef, newRef, readRef)
import Data.Int (fromString)
import Data.Maybe (fromMaybe)
Could not match type
Maybe
with type
Map LuminaireId
while trying to match type Maybe t1
setLight :: forall e. LuminaireId -> LightId -> LightState -> AppState -> Eff (ref :: REF | e) Boolean
setLight luminaireId lightId lightState appState = do
curLuminaireStateMaybe <- lookup luminaireId (liftEff $ readRef appState)
case curLuminaireStateMaybe of
Just curLuminaireState ->
modifyRef appState (\luminaires -> insert luminaireId )