Map [1]
| Operation | Time Complexity |
|---|---|
| Access | O(log n) |
| Search | O(log n) |
| Insertion | O(n) for < 32 elements, O(log n) for >= 32 elements [2] |
| Deletion | O(n) for < 32 elements, O(log n) for >= 32 elements |
| ## Example unit test for `AmountFormatter` module | |
| defmodule GroceryBudget.AmountFormatterTest do | |
| use ExUnit.Case | |
| alias GroceryBudget.Utils.AmountFormatter | |
| describe "AmountFormatter" do | |
| @tag :amount_formatter | |
| test "to_db/1 should multiply by 100" do | |
| assert AmountFormatter.to_db(500) == 50000 | |
| end |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| " Plug | |
| call plug#begin() | |
| Plug 'ayu-theme/ayu-vim' | |
| Plug 'morhetz/gruvbox' | |
| Plug 'Pocco81/Catppuccino.nvim' | |
| Plug 'junegunn/goyo.vim' | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'junegunn/vim-journal' |
This function returns the nearest aspect ratio of a width and height within a limited range of possible aspect ratios.
In other words, while 649x360 technically has an aspect ratio of 649:360, it’s often useful to know that the nearest normal aspect ratio is actually 9:5 (648x360).
nearestNormalAspectRatio(width, height, [side], [maxWidth], [maxHeight])
| ... | |
| import Ecto.Query | |
| date = ~D[2021-03-22] | |
| # fetch by date | |
| query = from a in Schema, where: fragment("?::date", a.createdAt) == ^date | |
| Repo.all(query) # fetch | |
| # fetch by range |
Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:
defp deps do
[
{:cowboy, "~> 1.0.0"},
{:plug, "~> 0.8.1"}
]
end| https://lynk.sh/ | |
| https://treact.owaiskhan.me/ | |
| https://mertjf.github.io/tailblocks/ | |
| https://cantabriadigital.es/ | |
| https://roar.market/ |
Thanks to the original blog post: https://equimper.com/blog/how-to-setup-tailwindcss-in-phoenix-1.4
cd assets
npm i --save-dev tailwindcss postcss-loader postcss-import