Mix.install(
[
{:midiex, "~> 0.6.1"},
{:instructor, "~> 0.0.5"}
],
config: [
instructor: [
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
config :phoenix, :json_library, ErlJson |
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
#!/usr/bin/env bash | |
# Abort sign off on any error | |
set -e | |
# Start the benchmark timer | |
SECONDS=0 | |
# Repository introspection | |
OWNER=$(gh repo view --json owner --jq .owner.login) |
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
#!/usr/bin/env -S bash -c "docker run -p 8080:8080 -it --rm \$(docker build --progress plain -f \$0 . 2>&1 | tee /dev/stderr | grep -oP 'sha256:[0-9a-f]*')" | |
# syntax = docker/dockerfile:1.4.0 | |
FROM node:20 | |
WORKDIR /root | |
RUN npm install sqlite3 |
Problem: accidentally pressing 'Esc' when editing a form in a "standard" LiveView modal dialog will discard all edits.
Proposed solution: Make the modal show a confirmation window on close when there have been changes on the form.
LiveView v0.20 was used.
Table of content
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
Notes on why I think Elixir is worth using for us | |
* Phoenix Channels - able to support 2 million concurrent clients on a single server. | |
* Node.js has an equivalent feature called SocketIO | |
* Ruby on Rails has an equivalent feature called ActionCable | |
* Not aware of any similar feature in Python | |
* Concurrency | |
* Ruby, restricted by a GIL | |
* Python, restricted by a GIL, but there is a proposal to remove it. Not sure how long it will take to remove it. | |
* Node.js, single-threaded async |
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
defmodule MyAppyWeb.TaskTestLive.Index do | |
use MyAppyWeb, :live_view | |
require Logger | |
alias Phoenix.LiveView.AsyncResult | |
@impl true | |
def mount(_params, _session, socket) do | |
socket = | |
socket | |
|> assign(:async_result, %AsyncResult{}) |
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
defmodule MyAppyWeb.TaskTestLive.Index do | |
use MyAppWeb, :live_view | |
require Logger | |
@impl true | |
def mount(_params, _session, socket) do | |
# Trap exits to catch when a Task is forcibly cancelled. | |
Process.flag(:trap_exit, true) | |
socket = |
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
Application.put_env(:sample, PhoenixDemo.Endpoint, | |
http: [ip: {127, 0, 0, 1}, port: 8080], | |
server: true, | |
live_view: [signing_salt: "bumblebee"], | |
secret_key_base: String.duplicate("b", 64), | |
pubsub_server: PhoenixDemo.PubSub | |
) | |
Mix.install([ | |
{:plug_cowboy, "~> 2.6"}, |
NewerOlder