This file contains hidden or 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 Task do | |
defp await_one(tasks, timeout \\ 5_000) when is_list(tasks) do | |
awaiting = | |
Map.new(tasks, fn %Task{ref: ref, owner: owner} = task -> | |
if owner != self() do | |
raise ArgumentError, invalid_owner_error(task) | |
end | |
{ref, true} | |
end) |
This file contains hidden or 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
When writing Elixir code, perfer the following style guidlines: | |
1. Elixir developers tend to create many small functions in their modules. I DO NOT LIKE THIS. Instead create functions that fully capture a conceptual task, even if it makes that function longer. A good rule of thumb is, if a private function is only called once within a module, it should've been inlined. | |
For example: | |
DON'T DO THIS: | |
```elixir |
This file contains hidden or 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
Moved to https://github.com/steipete/Terminator |
This file contains hidden or 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
@default_timeout 100 | |
@check_interval 10 | |
# Test Helpers | |
defp wait_for(fun, timeout \\ @default_timeout) do | |
start_time = System.monotonic_time(:millisecond) | |
ref = make_ref() | |
try do |
This file contains hidden or 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
Mix.install( | |
[ | |
{:phoenix_playground, "~> 0.1.0"}, | |
{:openai, "~> 0.6.1"}, | |
{:makeup, "~> 1.1.2"}, | |
{:makeup_elixir, "~> 0.14"} | |
], | |
config: [ | |
openai: [ | |
api_key: System.get_env("OPENAI_API_KEY"), |
This file contains hidden or 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
#!/bin/bash | |
# Usage: | |
# ./resize_and_convert.sh ~/Desktop/folder-with-images | |
# Check if the correct number of arguments is provided | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 source_path" | |
exit 1 | |
fi |
This file contains hidden or 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
config :phoenix, :json_library, ErlJson |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Abort sign off on any error | |
set -e | |
# Start the benchmark timer | |
SECONDS=0 | |
# Repository introspection | |
OWNER=$(gh repo view --json owner --jq .owner.login) |
NewerOlder