Mix.install([{:benchee, "~> 1.0", only: :dev}, {:plug, "~> 1.14"}])
iterations = 10
# Compares the strings with "=="
# Returns 'nil' to minimize time spent on allocating and moving around memory
variable_compare = fn left, right ->
for _ <- 1..iterations, do: left == right
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 13 columns, instead of 9 in line 5.
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
medal_type,medal_code,medal_date,name,gender,discipline,event,event_type,url_event,code,country_code,country,country_long | |
Gold Medal,1,2024-07-27,Remco EVENEPOEL,M,Cycling Road,Men's Individual Time Trial,ATH,/en/paris-2024/results/cycling-road/men-s-individual-time-trial/fnl-000100--,1903136,BEL,Belgium,Belgium | |
Silver Medal,2,2024-07-27,Filippo GANNA,M,Cycling Road,Men's Individual Time Trial,ATH,/en/paris-2024/results/cycling-road/men-s-individual-time-trial/fnl-000100--,1923520,ITA,Italy,Italy | |
Bronze Medal,3,2024-07-27,Wout van AERT,M,Cycling Road,Men's Individual Time Trial,ATH,/en/paris-2024/results/cycling-road/men-s-individual-time-trial/fnl-000100--,1903147,BEL,Belgium,Belgium | |
Gold Medal,1,2024-07-27,Grace BROWN,W,Cycling Road,Women's Individual Time Trial,ATH,/en/paris-2024/results/cycling-road/women-s-individual-time-trial/fnl-000100--,1940173,AUS,Australia,Australia | |
Silver Medal,2,2024-07-27,Anna HENDERSON,W,Cycling Road,Women's Individual Time Trial,ATH,/en/paris-2024/results/cycling-road/women-s- |
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
[ | |
{ | |
"context": "Pane", | |
"bindings": { | |
"ctrl-shift-tab": "pane::ActivatePrevItem", | |
"ctrl-tab": "pane::ActivateNextItem", | |
"cmd-shift-t": "workspace::NewTerminal" | |
} | |
}, | |
{ |
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
#!/bin/bash | |
# Updates either the Elixir or erlang version everywhere in the project | |
set -e | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 old_version new_version. Example: $0 1.15.7 1.16.1" | |
exit 1 | |
fi |
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 MyApp.Http do | |
@moduledoc """ | |
Exposes functions to make HTTP requests and optionally cache the response. | |
If you want to cache the request, simply add `cache: true` to the | |
request options. You can also define an option time-to-live (TTL) with | |
`cache_ttl: ttl_in_milliseconds`. The default TTL is 5min. | |
Only caches 2xx responses. | |
""" |
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 Attack.Worker do | |
use GenServer | |
require Logger | |
def start_link(init_args) do | |
GenServer.start_link(__MODULE__, [init_args]) | |
end | |
def init(_args) do |
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
## Migration | |
def up do | |
create table(:books) do | |
add :title, :string | |
add :summary, :text | |
add :language, :text | |
end | |
for lang <- ['english', 'spanish', 'italian'] do | |
execute """ |
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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Build", | |
"type": "shell", | |
"command": "mix compile", | |
"problemMatcher": ["$mixCompileError", "$mixCompileWarning"], | |
"group": { | |
"kind": "build", |
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 Terminvergabe do | |
@moduledoc """ | |
This script checks for available appointments in the "Bürgeramt" (city hall) | |
every 5min and notifies a user via Pushover if new appointments become were added. | |
In order to use Pushover, you must configure the following environment variables: | |
PUSHOVER_USER | |
PUSHOVER_TOKEN |
NewerOlder