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 n2lbr do | |
| @doc """ | |
| Replace newlines with <br />. | |
| ## Examples | |
| iex> Nl2br('abc\ndef') | |
| "abc<br/>def" | |
| """ |
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
| alias :observer, as: O | |
| alias :debugger, as: D | |
| local_time = fn -> | |
| {_date, {hour, minute, _second}} = :calendar.local_time() | |
| hour = | |
| case(hour > 12) do | |
| true -> hour - 12 | |
| false -> hour |
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 ApiWeb do | |
| @moduledoc """ | |
| The entrypoint for defining your web interface, such | |
| as controllers, views, channels and so on. | |
| This can be used in your application as: | |
| use ApiWeb, :controller | |
| use ApiWeb, :view |
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 ApiWeb.Metrics.AudioConversionsLive do | |
| use Phoenix.LiveView | |
| use ApiWeb.Live.AuthHelper, otp_app: :api | |
| alias Api.Audio.File.Conversions | |
| alias Phoenix.LiveView.Socket | |
| def mount(%{"id" => id}, session, socket) do | |
| socket = maybe_mount_user(socket, session) |
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 AudioConverter.Conversion.Server do | |
| use GenServer | |
| require Logger | |
| @lock_interval_seconds 10000 | |
| defstruct( | |
| filesize: [], | |
| source: nil, | |
| destination: nil |
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
| --- | |
| id: 7 | |
| title: "A simple way to automatically set the semantic version of your Elixir app" | |
| date: 2019-06-07T07:47:32Z | |
| layout: default | |
| tags: | |
| - elixir | |
| - Phoenix | |
| - Semver | |
| - Version |
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
| DOMAIN ?= mydomain.com | |
| COUNTRY := IT | |
| STATE := IT | |
| COMPANY := Evil Corp. | |
| # credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309 | |
| # usage: |
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
| #!/bin/bash | |
| ## place in the app root ie / | |
| echo "This will reinit the db, create ssl keys and the main website" | |
| PLATFORM_DIRECTORY=$(pwd) | |
| PHOENIX_DIRECTORY="apps/api" | |
| DB_DIRECTORY="apps/db" |
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
| type location = { | |
| street_number: string, | |
| route: string, | |
| locality: string, | |
| administrative_area_level_1: string, | |
| country: string, | |
| postal_code: string | |
| } |
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
| type marshalled_location = {. | |
| "administrative_area_level_1": string, | |
| "country": string, | |
| "locality": string, "postal_code": string, | |
| "route": string, | |
| "street_number": string | |
| } | |
| type input = { | |
| key: string, |
NewerOlder