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
# The helper functions for the test module. To make it possible to import | |
# this helper module in the test module, define this module outside the context that uses it. | |
defmodule MyTest.Helpers do | |
@spec fake_params(Enumrable.t()) :: map | |
def fake_params(override \\ %{}) do | |
%{ | |
country: "jp", | |
phone_number: Faker.phone_number(), | |
locale: "ja", | |
company: "My Company", |
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
# https://elixirforum.com/t/passing-in-options-maps-vs-keyword-lists/1963 | |
@doc """ | |
do foo operation | |
## Options | |
- `:option1` - option 1 | |
- `:option2` - option 2 | |
""" |
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 MyModule do | |
@moduledoc false | |
if Mix.env() == :prod do | |
@foo Application.fetch_env!(:myapp, :foo) | |
def foo, do: @foo | |
else | |
def foo, do: Application.fetch_env!(:myapp, :foo) | |
end | |
end |
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 your phrase then ^D | |
perl -pe 'chop;s/([a-z]+)/lc($1)/ige' | perl -lpe 's/[^a-z0-9]+/-/ig' |
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 | |
#replace_selected | |
echo -n "$2" | /usr/local/bin/jq . |
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
defp docs_before_closing_head_tag(:html) do | |
~s{<link rel="stylesheet" href="assets/doc.css">} | |
end | |
defp docs_before_closing_head_tag(_), do: "" |
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
def project do | |
[ | |
apps_path: "apps", | |
build_embedded: Mix.env() == :prod, | |
start_permanent: Mix.env() == :prod, | |
aliases: aliases(), | |
deps: deps(), | |
# Docs | |
name: "MyProject", |
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
+++ | |
date = {{ .Date }} | |
title = "{{ $t := now }}{{ $t.Format "1月2日"}}{{ if eq ($t.Weekday) 0 }}(日){{ end }}{{ if eq ($t.Weekday) 1 }}(月){{ end }}{{ if eq ($t.Weekday) 2 }}(火){{ end }}{{ if eq ($t.Weekday) 3 }}(水){{ end }}{{ if eq ($t.Weekday) 4 }}(木){{ end }}{{ if eq ($t.Weekday) 5 }}(金){{ end }}{{ if eq ($t.Weekday) 6 }}(土){{ end }}" | |
+++ |
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
# Create a private key | |
$ openssl genrsa -out private-key.pem 2048 | |
# and public key | |
$ openssl rsa -in private-key.pem -pubout -out public-key.pem |
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
git branch | grep -v -e 'master' -e 'deployment/' -e 'develop' -e '*' | xargs git branch -D |