- Create namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: gitlab
kubectl create -f ./namespace.yaml
Application.put_env(:elixir, :ansi_enabled, true) | |
# IEx shell customization for color | |
# - Added as a comment: https://thinkingelixir.com/course/code-flow/module-1/pipe-operator/ | |
# - Original source: https://samuelmullen.com/articles/customizing_elixirs_iex/ | |
# - Can add to a specific project or can put in the User home folder as a global config. | |
# Updates from: | |
# - https://github.com/am-kantox/finitomata/blob/48e1b41b21f878e9720e6562ca34f1ce7238d810/examples/ecto_intergation/.iex.exs | |
timestamp = fn -> | |
{_date, {hour, minute, _second}} = :calendar.local_time |
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{}) |
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 = |
defmodule MyApp.Books.Book do | |
use Ecto.Schema | |
import Ecto.Query, warn: false | |
import Ecto.Changeset | |
import MyApp.ChangesetHelpers | |
schema "books" do | |
field :name, :string | |
field :genres, {:array, :string}, default: [] |
defmodule Acme.Repo do | |
use Ecto.Repo, | |
otp_app: :acme, | |
adapter: Ecto.Adapters.Postgres | |
def with_prefix(prefix) do | |
module_atom = Module.concat([Acme, Repo, WithPrefix, Macro.camelize(prefix)]) | |
# We could not find a better way to see if this module already existed | |
if !Kernel.function_exported?(module_atom, :prefix, 0) do |
defmodule Point2D do | |
defstruct [x: 0, y: 0] | |
end | |
defmodule Point3D do | |
defstruct [x: 0, y: 0, z: 0] | |
end | |
defmodule RowPolymorphism do | |
def get_x_y(%{x: x, y: y} = _data) do |
apiVersion: v1
kind: Namespace
metadata:
name: gitlab
kubectl create -f ./namespace.yaml
FROM elixir:1.6.5-alpine | |
ARG DEV_USER=1000 | |
RUN apk add --no-cache \ | |
# bash terminal Support | |
bash \ | |
# development - could be separated/virtual for removal, but lets just get the bin going -BJG | |
inotify-tools wget curl smem tar gcc g++ libc-dev libffi-dev make \ | |
# utilities |
defmodule Config do | |
@moduledoc """ | |
This module handles fetching values from the config with some additional niceties | |
""" | |
@doc """ | |
Fetches a value from the config, or from the environment if {:system, "VAR"} | |
is provided. | |
An optional default value can be provided if desired. |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[Queue for rendering 1 at a time]"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/q.js/1.0.1/q.js"></script> | |
<script src="https://npmcdn.com/@reactivex/[email protected]/dist/global/Rx.umd.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style> |