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 Readable.Emails.MJML do | |
@external_resource __DIR__ | |
def mjml_template(path) do | |
template = path |> Path.expand(__DIR__) |> File.read!() | |
{:ok, html} = | |
~r|<mj-include\s+path="([^"]*)"\s+/>| | |
|> Regex.scan(template) | |
|> Enum.map(fn [match, path] -> |
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 Readable.Transloadit do | |
use Tesla | |
plug Tesla.Middleware.BaseUrl, "https://api2.transloadit.com/" | |
plug Tesla.Middleware.JSON | |
@behaviour Readable.Transloadit.TransloaditAPI | |
@impl true | |
def run_assembly(assembly, file_path, source_container, target_container) 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
defmodule ReadableWeb.Pagination do | |
use Phoenix.Component | |
attr :page, :integer, required: true | |
attr :page_count, :integer, required: true | |
attr :path, :string, required: true | |
def pagination(assigns) do | |
~H""" | |
<ul class="inline-flex items-center h-8"> |
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
#! /usr/bin/env bash | |
export GITHUB_TOKEN="REDACTED" | |
branch=$1 | |
pr_number=$(gh pr list -H $branch --json number | jq ".[0].number") | |
# testing if $pr_number is a number | |
if [ "$pr_number" -eq "$pr_number" ]; then | |
echo "found PR: $pr_number" |
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 AppSignalTelemetry do | |
use GenServer | |
require Appsignal.Utils | |
import Appsignal.Utils, only: [module_name: 1] | |
@tracer Appsignal.Utils.compile_env(:appsignal, :appsignal_tracer, Appsignal.Tracer) | |
@span Appsignal.Utils.compile_env(:appsignal, :appsignal_span, Appsignal.Span) | |
@appsignal_namespace "live_view" | |
def start_link 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
= live_component @socket, Table, | |
headers: [id: "ID", last_name: "Nom et email", actions: ""], | |
sortable: [:id, :last_name], | |
selectable: :checkbox, | |
mobile_hidden: [:id, :actions], | |
current_sorting: @table_sorting, | |
row_count: @user_count, | |
selected_row_count: @selected_user_count, | |
sticky_header: true 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
const Hooks = { ViewportResizeHooks} | |
const connectLiveSocket = () => { | |
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content') | |
const liveSocket = new LiveSocket('/my_app/live', Socket, { | |
params: { | |
_csrf_token: csrfToken, | |
viewport: { | |
width: window.innerWidth, | |
height: window.innerHeight |
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 Flow.EctoProducer do | |
use GenStage | |
import Ecto.Query | |
@default_chunk_size 5000 | |
@default_key :id | |
@stop_delay 10 | |
# Possible options for producer |
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
$> mix n_test 1 4 | |
$> mix n_test 2 4 | |
$> mix n_test 3 4 | |
$> mix n_test 4 4 |
NewerOlder