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
<style> | |
@keyframes expander_appear { | |
100% { opacity: 1; max-height: 300px} | |
} | |
.expander { | |
animation: expander_appear 900ms 10ms ease-out forwards; | |
opacity: 1; max-height:0px; overflow: hidden; | |
} | |
</style> |
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
# I found Stream.unfold to be quite useful for places where I don’t know how many iterations are #needed to get to the end. | |
Stream.unfold([], fn words -> | |
if length(words) < target_length do | |
words = | |
(words ++ get_new_words()) | |
|> Enum.uniq() | |
{new_words, words} | |
else |
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
def get_next_in_list(list, item) when is_list(list) do | |
Enum.find_index(list, fn e -> e == item end) | |
|> case do | |
nil -> | |
nil | |
idx -> | |
Enum.at(list, idx + 1) | |
end | |
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
<section> | |
<div class="mt-2 mb-4 text-xl font-bold">Import-Attempts</div> | |
<div | |
class="flex p-1 space-x-4 overflow-x-scroll cursor-all-scroll" | |
x-data={"horizontalscroll(#{length(@attempts)})"} | |
> | |
<%= for item <- @attempts do %> | |
<.editlink | |
upload_id={item.upload_id} |
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
<section class="flex space-x-4"> | |
<article> | |
<div class="mt-2 mb-4 text-xl font-bold">Rodents</div> | |
<table> | |
<thead class="[&>tr>*]:p-2 [&_th]:font-normal [&_th]:text-sm [&_th]:border [&_.num]:text-right "> | |
<tr> | |
<th>id</th> | |
<th>name</th> | |
<th class="num">price</th> | |
</tr> |
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
<div class="font-mono text-xs whitespace-pre-wrap">form_state: <%= @form_state |> inspect(pretty: true) %></div> | |
<div class="font-mono text-xs whitespace-pre-wrap">saved_form_state: <%= @saved_form_state |> inspect(pretty: true) %> </div> | |
<div class="font-mono text-xs whitespace-pre-wrap">form_changeset: <%= @form_changeset |> inspect(pretty: true) %></div> | |
<div class="max-w-[300px] my-5"> | |
<%= f = form_for(@form_changeset, "#", [ as: :form_data, phx_submit: :save, phx_change: :validate]) %> | |
<%= input f, :keyword, label: "Keyword" %> | |
<%= submit "save", class: "btn btn-outline text-sm mt-4" %> |
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
# sample mount | |
# @impl true | |
# def mount(params, _session, socket) do | |
# context = %{ | |
# params: params, | |
# lang: "en" | |
# } | |
# initial_form_state = get_initial_form_state(socket.assigns) | |
# {:ok, |
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 | |
LOAD=$(awk '{print $1}' /proc/loadavg) | |
if [ $(echo "$LOAD > 2" | bc) = 1 ]; then | |
log_path="/var/log/loadlog" | |
daystr=`date +%Y_%m/%d` | |
minutestr=`date +%H_%M` |