Skip to content

Latest commit

 

History

History
145 lines (107 loc) · 4.19 KB

README.md

File metadata and controls

145 lines (107 loc) · 4.19 KB

Freecodecamp exercises using Elixir

Solving exercises from Freecodecamp.org using Elixir programming language. Includes benchmarks and tests for every functions.

Last Commit Commit activity Dependabot Actions Status Coverage Hex.pm Hexdocs

Folders that are interesting to read can be found at:

Elixir installation

Either use Docker, this Docker automated install script curl -sSL https://get.docker.com/ | sh, or use asdf.

Using Docker

using docker_start shell script (use wsl on windows or git bash, otherwise this works both ?mac? and linux), or see the file if you want to use docker commands instead.

# I haven't tried this both on windows and mac, YMMV
source docker_start

Why source docker_start instead of chmod +x ./docker_start? read run bash script doesn't work alias command.

Getting dependencies

mix deps.get --only test

Launch REPL

iex -S mix

Stopping Elixir container, remove alias created by shell script

# where "elixir" is the name of the container
docker container stop elixir

# temporary alias are not persisted across different sessions
# but if you want to remove them
unalias elixir iex mix elixirc

Create Pre-commit Hook

mix precommit

Test

mix test

Coverage

mix text --cover

Selective tests

# i.e. you want to test only "Basic Algorithms"
mix selective_test basic_algo

# or more, separated by spaces
mix selective_test basic_algo intermediate_algo

# basic_algo        = Basic Algorithm Scripting
# intermediate_algo = Intermediate Algorithm Scripting

Generate HTML Docs

# running this generates docs in "doc/" directory
mix docs

Benchmarks (using Benchee)

# view benchmark commands
mix help benchmark
# list available functions
mix benchmark --list
# specific function
mix benchmark mutation
# benchmark results saved as html in "benchmarks/" directory
mix benchmark mutation --html