This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian | |
# instead of Alpine to avoid DNS resolution issues in production. | |
# | |
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu | |
# https://hub.docker.com/_/ubuntu?tab=tags | |
# | |
# This file is based on these images: | |
# | |
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image | |
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2021/09/13 13:36:33 pg_restore: skipping item 3706 TABLE DATA SequelizeMeta | |
2021/09/13 13:36:33 pg_restore: launching item 3488 CONSTRAINT SequelizeMeta SequelizeMeta_pkey | |
2021/09/13 13:36:33 pg_restore: skipping item 3707 TABLE DATA table1 | |
2021/09/13 13:36:33 pg_restore: skipping item 3489 INDEX table1_readAt_idx | |
2021/09/13 13:36:33 pg_restore: skipping item 3490 INDEX itemId_readAt_unique_index | |
2021/09/13 13:36:33 pg_restore: skipping item 3561 TRIGGER table1 ts_insert_blocker | |
2021/09/13 13:36:33 pg_restore: skipping item 3708 TABLE DATA table2 | |
2021/09/13 13:36:33 pg_restore: skipping item 3491 INDEX table2_readAt_idx | |
2021/09/13 13:36:33 pg_restore: skipping item 3492 INDEX table2_itemId_readAt_unique_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/emoji_game/actor.ex | |
# Non-player character client | |
defmodule EmojiGame.Actor do | |
use GenServer | |
# ... code ... | |
@impl true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tester do | |
def update!(map) do | |
try do | |
{:ok, Map.update!(map, :blah, fn v -> v end)} | |
rescue | |
e in KeyError -> {:error, :no_key} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file path should be .circleci/config.yml | |
version: 2 # use CircleCI 2.0 instead of CircleCI Classic | |
jobs: # basic units of work in a run | |
build: # runs not using Workflows must have a `build` job as entry point | |
parallelism: 1 # run only one instance of this job | |
docker: # run the steps with Docker | |
- image: circleci/elixir:1.11.3 # ...with this image as the primary container; this is where all `steps` will run | |
auth: | |
username: $DOCKER_USER | |
password: $DOCKER_PASS # context / project UI env-var reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyAppWeb.Graphql.Middleware.RelayConnectionLazyEvaluate do | |
@moduledoc """ | |
Absinthe requires all of the data for a connection to be loaded in the `resolve` | |
for the field. This means that regardless of if a client requests `edges` or | |
`totalCount`, the server needs to do one query for both every time. | |
This middleware evaluates the query that was done by the client to figure out | |
what fields were requested. It will only load the data which is required for | |
a typical connection based on what the client has requested |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warming up -------------------------------------- | |
interpolation 151.958k i/100ms | |
StringIO << 57.897k i/100ms | |
StringIO concat 103.750k i/100ms | |
Calculating ------------------------------------- | |
interpolation 2.482M (± 9.9%) i/s - 9.877M in 4.027092s | |
StringIO << 45.806B (±33.8%) i/s - 119.834B | |
StringIO concat 100.679B (±15.4%) i/s - 272.862B | |
Comparison: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def die_roll | |
rand(6) + 1 | |
end | |
def attack(attacking_count, defending_count) | |
attacking_dice = [attacking_count, 3].min | |
defending_dice = [defending_count, 2].min | |
attacking_rolls = attacking_dice.times.map { die_roll }.sort.reverse | |
defending_rolls = defending_dice.times.map { die_roll }.sort.reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# R setup | |
library(RNeo4j) | |
graph = startGraph("http://localhost:7474/db/data/") | |
# Queries: | |
# What types of objects are we dealing with? | |
MATCH (n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g mouse on | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
bind-key -n S-Up resize-pane -U 5 | |
bind-key -n S-Down resize-pane -D 5 | |
bind-key -n S-Left resize-pane -L 5 | |
bind-key -n S-Right resize-pane -R 5 |
NewerOlder