Mix.install([
{:reactor, "~> 0.15.5"},
{:kino, "~> 0.16.0"},
{:nanoid, "~> 2.1"}
])
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) |
action :analyze_sentiment, :atom do | |
constraints one_of: [:positive, :negative] | |
description """ | |
Analyzes the sentiment of a given piece of text to determine if it is overall positive or negative. | |
""" | |
argument :text, :string do | |
allow_nil? false | |
description "The text for analysis" |
Testimonies
The thing in CL I miss most doing Clojure as my day job? CL's compiler. I like having a compiler tell me at compile time about the mistakes I've made. Bogus arguments. Unreachable code because of unhandled exceptions, and so on. CL saves me round after round of bugs that in clojure aren't found until you run the code. If you test well, it's found when testing, if you don't it's found in production. "Clojure compiler" almost demands air quotes.
CL's optional but oh-so-useful model of type declarations is also infinitely more useful (to me) than Clojure's use of "spec", and instrumentation that happens only at test time because of the cost. Depending on the OPTIMIZE declarations, other type defs are a floor wax and dessert topping. Want checks for argument types? Lower optimizations. Want most efficient machine code? High optimizations.
/u/Decweb, March 2023 https://www.reddit.com/r/lisp/comments/11ttnxk/the_rise_fall_of_lisp_too_good_for_the_rest_of/jczpysp/
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 |
@doc """ | |
Renders an icon. | |
Supports three icon libraries: | |
- [Heroicons](https://heroicons.com) - prefixed with "hero-" | |
- [Lucide](https://lucide.dev) - prefixed with "lucide-" | |
- [Simple Icons](https://simpleicons.org) - prefixed with "si-" | |
You can customize the size and colors of the icons by setting | |
width, height, and background color classes. |
I have this abstraction in my application code called a "CloudFile". This is where I store in the database information about
files on S3 and it gives me a resource for other resources to own. For example, a user would have an avatar_cloud_file_id
.
On the front-end, I would load this relationship and display the avatar with user.avatar_cloud_file.download_url
defmodule RL.CloudFile do
use Ecto.Schema
import Ecto.Changeset
@timestamps_opts type: :utc_datetime_usec
These three scripts can provide you a cursor style CMD+K Like experience in any terminal.
- Set
logged-shell
to be your default shell for your terminal emulator.shell = /path/to/logged-shell
in~/.config/kitty/kitty.conf
for kitty users. - This will stream both the inputs and outputs of your terminal session into a file defined at
$SHELL_LOG_FILE
- The
ai-bash-command
will take a user prompt, add the shell as context, and call OpenAI (with theai
command) to get the bash command that satisfies the prompt. - It will type the results back into your terminal using
wtype
for wayland users.
Last updated March 13, 2024
This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.
Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.
For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.