Skip to content

Instantly share code, notes, and snippets.

Usage

Just eval the file right in the beginning of each config.exs file. It will load the env of the .env files every time the project is compiled.

Umbrella

__ENV__.file()
|> Path.dirname()
|> Path.join("../../../config/dotenv.exs")
@thiamsantos
thiamsantos / pre-commit.sh
Created March 20, 2019 23:42
Precommit format
#!/bin/bash
for file in $(git diff --name-only --staged | sort | uniq | grep ".exs\?")
do
mix format $file
git add $file
done
defmodule Bump do
def run do
patterns = [
{"mix.exs", ~r/@version\s"(?<version>\d+.\d+.\d+)"/, &mix_builder/1},
{"README.md", ~r/{:red_mutex,\s*"~>\s*(?<version>\d+.\d+.\d+)"}/, &readme_builder/1}
]
type = type()
{files, new_version} = patterns

Keybase proof

I hereby claim:

  • I am thiamsantos on github.
  • I am thiamsantos (https://keybase.io/thiamsantos) on keybase.
  • I have a public key ASC2MA2HxSpWfRT57QpLO9ah51fD3oY8vf7-pPUdnEddnAo

To claim this, I am signing this object:

defmodule App.PhoneNumber do
use Ecto.Type
defstruct country_code: nil,
national_number: nil,
extension: nil,
italian_leading_zero: nil,
number_of_leading_zeros: nil,
raw_input: nil,
country_code_source: nil,
title description logo
Spotify
Show what you're listening to.
spotify.png
import { getNowPlaying } from '../../lib/spotify';
const Sequencer = require('@jest/test-sequencer').default;
class CustomSequencer extends Sequencer {
sort(tests) {
const totalPartitionsEnv = process.env.JEST_TOTAL_PARTITIONS;
const partitionEnv = process.env.JEST_PARTITION;
if (totalPartitionsEnv && partitionEnv) {
const totalPartitions = parseInt(totalPartitionsEnv, 10);
const partition = parseInt(partitionEnv, 10);