freecodecamp_elixir
所属分类:数学计算
开发工具:Elixir
文件大小:27KB
下载次数:0
上传日期:2023-02-06 04:02:49
上 传 者:
sh-1993
说明: 使用Elixir编程语言解决Freecodecamp.org中的练习。包括每个fu的基准和测试...
(Solving exercises from Freecodecamp.org using Elixir programming language. Includes benchmarks and tests for every functions.)
文件列表:
.dockerignore (135, 2022-09-04)
.formatter.exs (108, 2022-09-04)
.iex.exs (131, 2022-09-04)
CHANGELOG.md (54, 2022-09-04)
Dockerfile (322, 2022-09-04)
LICENSE (1075, 2022-09-04)
benchmarks (0, 2022-09-04)
benchmarks\basic_algo.exs (12112, 2022-09-04)
benchmarks\intermediate_algo.exs (3395, 2022-09-04)
config (0, 2022-09-04)
config\.credo.exs (315, 2022-09-04)
coveralls.json (136, 2022-09-04)
docker_start (1625, 2022-09-04)
lib (0, 2022-09-04)
lib\freecodecamp_elixir.ex (55, 2022-09-04)
lib\freecodecamp_elixir (0, 2022-09-04)
lib\freecodecamp_elixir\algo_projects.ex (287, 2022-09-04)
lib\freecodecamp_elixir\basic_algo.ex (16263, 2022-09-04)
lib\freecodecamp_elixir\intermediate_algo.ex (3116, 2022-09-04)
lib\mix (0, 2022-09-04)
lib\mix\tasks (0, 2022-09-04)
lib\mix\tasks\precommit.ex (2007, 2022-09-04)
lib\mix\tasks\selective_test.ex (1531, 2022-09-04)
mix.exs (2523, 2022-09-04)
mix.lock (7186, 2022-09-04)
test (0, 2022-09-04)
test\basic_algo_test.exs (12445, 2022-09-04)
test\intermediate_algo_test.exs (1836, 2022-09-04)
test\test_helper.exs (15, 2022-09-04)
# Freecodecamp exercises using Elixir
Solving exercises from Freecodecamp.org using Elixir programming language. Includes benchmarks and tests for every functions.
[//]: # "Badges"
[![Last Commit][commit-badge]](https://github.com/jaeyson/freecodecamp_elixir/commit/main)
[![Commit activity][pulse-badge]](https://github.com/jaeyson/freecodecamp_elixir/pulse)
[![Dependabot][dependabot-badge]](https://github.com/jaeyson/freecodecamp_elixir/pulls/app%2Fdependabot)
[![Actions Status][actions-badge]](https://github.com/jaeyson/freecodecamp_elixir/actions)
[![Coverage][coverage-badge]](https://coveralls.io/github/jaeyson/freecodecamp_elixir?branch=main)
[![Hex.pm][hex-badge]](https://hex.pm/packages/freecodecamp_elixir)
[![Hexdocs][hexdocs-badge]](https://hexdocs.pm/freecodecamp_elixir)
[//]: # "Image sources"
[commit-badge]: https://img.shields.io/github/last-commit/jaeyson/freecodecamp_elixir.svg
[pulse-badge]: https://img.shields.io/github/commit-activity/m/jaeyson/freecodecamp_elixir
[dependabot-badge]: https://img.shields.io/badge/Dependabot-enabled-green
[actions-badge]: https://github.com/jaeyson/freecodecamp_elixir/actions/workflows/ci.yml/badge.svg
[coverage-badge]: https://coveralls.io/repos/github/jaeyson/freecodecamp_elixir/badge.svg?branch=main
[hex-badge]: https://img.shields.io/hexpm/v/freecodecamp_elixir
[hexdocs-badge]: https://img.shields.io/badge/hex-docs-blue
Folders that are interesting to read can be found at:
- [`lib/`](https://github.com/jaeyson/freecodecamp_elixir/tree/main/lib/)
- [`test/`](https://github.com/jaeyson/freecodecamp_elixir/tree/main/test/)
## Elixir installation
Either use [Docker](https://docs.docker.com/get-docker/), this Docker automated install script `curl -sSL https://get.docker.com/ | sh`, or use [`***f`](https://***f-vm.com/#/core-manage-***f).
## 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.
```bash
# 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](https://unix.stackexchange.com/a/38***55/437416).
#### Getting dependencies
```bash
mix deps.get --only test
```
#### Launch REPL
```bash
iex -S mix
```
#### Stopping **Elixir** container, remove alias created by shell script
```bash
# 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
```bash
mix precommit
```
## Test
```bash
mix test
```
#### Coverage
```bash
mix text --cover
```
#### Selective tests
```bash
# 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
# algo_projects = Algorithm Projects
```
## Generate `HTML` Docs
```bash
# running this generates docs in "doc/" directory
mix docs
```
## Benchmarks (using Benchee)
If you want to benchmark a specific function:
```bash
# NOTE: file path is at
# freecodecamp_elixir/benchmarks/basic_algo.exs
# Example: change the function name from
# "mutation" to "repeat_string"
# BasicAlgo.run("mutation", HTML)
# or uncomment lines to use that instead
BasicAlgo.run("repeat_string", HTML)
# you can use the default formatter (console)
BasicAlgo.run("repeat_string", Console)
```
```bash
mix run benchmarks/basic_algo.exs
```
近期下载者:
相关文件:
收藏者: