Links:
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 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); |
title | description | logo |
---|---|---|
Spotify |
Show what you're listening to. |
spotify.png |
import { getNowPlaying } from '../../lib/spotify';
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 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, |
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:
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 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 |
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
#!/bin/bash | |
for file in $(git diff --name-only --staged | sort | uniq | grep ".exs\?") | |
do | |
mix format $file | |
git add $file | |
done |
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 Crypto do | |
def encrypt(data, key) when is_binary(data) and is_binary(key) do | |
iv = :crypto.strong_rand_bytes(16) | |
cipher = :crypto.block_encrypt(:aes_cbc256, hash_key(key), iv, pad(data)) | |
Base.encode64("#{iv}#{cipher}") | |
end | |
def decrypt(digest, key) when is_binary(digest) and is_binary(key) do | |
text = Base.decode64!(digest) |
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
valid_branchs = [ | |
"master" | |
] | |
"git" | |
|> System.cmd(["branch"]) | |
|> elem(0) | |
|> String.split("\n") | |
|> Enum.map(&String.trim/1) | |
|> Enum.reject(&match?("", &1)) |
NewerOlder