Skip to content

Instantly share code, notes, and snippets.

@petermueller
petermueller / http_utils_download.ex
Created May 6, 2023 05:56
Content-Disposition Library ideas?
defmodule HttpUtils.Download do
@moduledoc """
A module for interacting with the `MyApp.Downloadable` protocol in a web context.
This module contains a collection of functions for commonly use-cases,
such as sending chunked streams on a `t:Plug.Conn.t/0`
"""
alias MyApp.Downloadable
@petermueller
petermueller / README.md
Last active September 29, 2023 10:41
Phoenix + esbuild + yarn + postcss + tailwindcss + cpx2

Getting started

If you just want to copy-paste this it should "just work", but you'll need to get yarn set up. Follow the instructions at https://yarnpkg.com/getting-started/install OR just run:

  • npm install -g yarn
  • yarn set version berry
  • yarn install # this should make a .yarn/, yarn.lock, and .pnp.js

Mix Tasks

If you want to run these outside of the context of a running phoenix server, you can also run the mix tasks, mix assets.install and mix assets.compile. They are a copy paste of some the CLI bits but you could abstract them out to point to a config/cmds.exs or something if you wanted.

esbuild

@petermueller
petermueller / release.Dockerfile
Created March 16, 2021 13:38 — forked from kyleVsteger/release.Dockerfile
Multistage Elixir 1.11 Phoenix Live View Release Dockerfile
ARG ALPINE_VERSION=3.12.0
FROM hexpm/elixir:1.11.0-erlang-23.1.1-alpine-3.12.0 as builder
ARG APP_VSN="1.0.0"
# Replace `your_app` with your otp application name.
ENV APP_NAME=your_app \
APP_VSN=${APP_VSN} \
MIX_ENV=prod
@petermueller
petermueller / supervision_with_child_spec.exs
Last active August 3, 2022 00:27
elixir OTP reminders
defmodule MyMod do
use GenServer
def child_spec(args) do
IO.inspect(args, label: "*** MyMod.child_spec/1")
%{
id: __MODULE__,
start: {__MODULE__, :start_link, [args]}
}
end
@petermueller
petermueller / keybase.md
Created August 15, 2016 14:53
Keybase Proof

Keybase proof

I hereby claim:

  • I am felix-starman on github.
  • I am felix_starman (https://keybase.io/felix_starman) on keybase.
  • I have a public key ASDJ7jlIXGmhSyJlKXtzkmIqrkk9_vjfM55sFvFH3jzk_Ao

To claim this, I am signing this object: