Skip to content

Instantly share code, notes, and snippets.

def join_game(user_id, game_id) do
with {:user, {:ok, user}} <- {:user, Users.get(user_id)},
{:game, {:ok, game}} <- {:game, Games.get(game_id)},
{:full, false} <- {:full, Game.is_full?(game)},
{:started, false} <- {:started, Game.is_started?(game)},
{:allowed, true} <- {:allowed, User.has_permission?(user, game)}
do
Game.add_user(game, user)
else
{:user, :not_found} -> {:error, "User not found"}
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@slavafomin
slavafomin / git-submodules.md
Last active April 15, 2024 14:11
Git submodules best practices

Git submodules best practices

Useful commands

— Clone repository with submodules automatically:

git clone --recursive git@github.com:name/repo.git

— Initialize submodules after regular cloning:

@heron2014
heron2014 / react-native-maps-enable-google-maps-instructions.md
Last active April 11, 2024 09:39
Visual instructions how to enable Google Maps on IOS using react-native-maps

Visual instructions how to enable Google Maps on IOS using react-native-maps

UPDATE: Following instructions are now a year old. I have recently managed to upgrade react-native-maps from 0.17 to the latest version 0.21 with react-native 0.51 - if you want to follow my instruction scroll down to the end this doc! Hope that will work for you too!

This is for my personal use, things might not be correctly explained here. For the official docs please check https://github.com/airbnb/react-native-maps

Steps from scratch:

1.react-native init GoogleMapPlayground

@martinaglv
martinaglv / 01.js
Last active May 10, 2019 07:03
What do these functions do?
function whatDoesItDo(val){
return val ? 1 : 2;
}