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
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 |
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
require 'google/apis/identitytoolkit_v3' | |
require 'google/apis/core/api_command' | |
require 'googleauth' | |
require 'addressable/template' | |
require 'json' | |
require 'securerandom' | |
# Request to delete account. | |
class CreateSessionCookieRequest | |
include Google::Apis::Core::Hashable |
NewerOlder