Skip to content

Commit e8f6340

Browse files
Article: R1.D3
1 parent 5cf06b8 commit e8f6340

File tree

3 files changed

+92
-32
lines changed

3 files changed

+92
-32
lines changed

content/articles/round-1-day-1.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,62 +9,67 @@ devToId: 602094
99
---
1010

1111
## TIL
12-
Currently during the 100DaysOfCode Challenge, I'm learning elixir. I'll be documenting everything I learn or build as I go. I'm starting off with learning the elixir basics at [ElixirSchool](http://elixirschool.com).
13-
12+
13+
Currently, during the 100DaysOfCode Challenge, I'm learning elixir. I'll be documenting everything I learn or build as I go. I'm starting off with learning the elixir basics at [ElixirSchool](http://elixirschool.com).
14+
1415
## Basics
16+
1517
- Everything is truthy except for `false` and `nil`
1618
- Booleans are atoms (:true, :false)
17-
- Modules are atoms
19+
- Modules are atoms
1820
- You can access erlang libraries using atoms
19-
- Aka atoms are important :)
21+
- Aka atoms are important :)
2022
- Strings use double quotes
2123
- No modulo operator, but there are the `div` and `rem` functions.
22-
- Each basic type has a rank :/
23-
- number < atom < reference < function < port < pid < tuple < map < list < bistring
24-
- I'll never memorize this lawl
24+
- Each basic type has a rank :/
25+
- number < atom < reference < function < port < pid < tuple < map < list < bistring
26+
- I'll never memorize this lawl
2527
- String interpolation "hello #{world}" or "hello " <> "world" ... Pretty Basic.
2628

2729
## Collections
30+
2831
- Lists
29-
- Mixed types
30-
- Not unique
31-
- Linked List → faster to prepend than append
32-
> In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes which together represent a sequence.
33-
- List concat `++/2` - cool
34-
- List sub `--/2` - cool cool
35-
- Head/Tail - cool cool cool
36-
- By pattern matching `[head | tail] = list` #=> head is the first element. tail will be all the others
37-
- `hd list` #=> returns the first element
38-
- `tl list` #=> returns all elements after the first
32+
- Mixed types
33+
- Not unique
34+
- Linked List → faster to prepend than append
35+
> In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes that together represent a sequence.
36+
- List concat `++/2` - cool
37+
- List sub `--/2` - cool cool
38+
- Head/Tail - cool cool cool
39+
- By pattern matching `[head | tail] = list` #=> head is the first element. the tail will be all the others
40+
- `hd list` #=> returns the first element
41+
- `tl list` #=> returns all elements after the first
3942
- Tuples
40-
- Stored with a set amount of memory
41-
- Access = fast; modification = slow
42-
- Common for return info from function
43+
- Stored with a set amount of memory
44+
- Access = fast; modification = slow
45+
- Common for return info from function
4346
- Keyword lists
44-
- commonly used to pass options to functions
47+
- commonly used to pass options to functions
4548
- Maps
46-
- The Go-to key-value store
47-
- Similar to ruby's hash
48-
- Updating syntax is cool?
49-
- useMap.put/3 to create a new key
49+
- The Go-to key-value store
50+
- Similar to ruby's hash
51+
- Updating syntax is cool?
52+
- useMap.put/3 to create a new key
5053

5154
## Enum
55+
5256
- Not much to go over here if you are familiar with any other languages Enum methods
5357

5458
## Pattern Matching
59+
5560
- The Holy Grail of Elixir
5661
- If you ask any dev what they love about elixir chances are they will mention pattern matching
57-
- Curveball `=` is actually a match operator similar to the equals sign in algebra :exploading-head:
62+
- Curveball `=` is actually a match operator similar to the equals sign in algebra :exploding-head:
5863
- [1| tail] = list #=> tail has not been matched so it binds to the last elements of the list
5964

6065
## Control Structures
6166

6267
- `if` and `unless` => straight forward
6368
- `case/2`
64-
- Similar to `switch`(in javascript) or `case` (ruby) except it uses pattern matching
65-
- `_` is a catch all like `default` in JavaScript
69+
- Similar to `switch`(in javascript) or `case` (ruby) except it uses pattern matching
70+
- `_` is a catch all like `default` in JavaScript
6671
- `Cond`
67-
- Used for matching multiple cases similar to an `else if`
72+
- Used for matching multiple cases similar to an `else if`
6873
- `With`
69-
- This one is bit trickier coming from other languages
70-
- Can be used to replace multiple `case` statements
74+
- This one is bit trickier coming from other languages
75+
- Can be used to replace multiple `case` statements

content/articles/round-1-day-3.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Round 1 Day 3
3+
published: true
4+
description: Finished https://elixirschool.com/en/lessons/basics
5+
tags: 100daysofcode, elixir
6+
cover_image: https://cdn.hashnode.com/res/hashnode/image/upload/v1613355044450/ggGLGvRqH.png?auto=compress
7+
datePosted: '2021-02-14'
8+
---
9+
10+
# Keep Moving Forward
11+
12+
Three days ago I started the #100DaysOfCode Challenge, and today I finished elixirschool.com basics for elixir. This feels great because I started those basics over a year ago and stopped.
13+
14+
Quick TL;DR; for today.
15+
16+
## Testing
17+
18+
- ExUnit is built in to elixir, so I'll prolly be using that for my testing framework.
19+
- Test Mocks. The elixir community has an interesting take on mocking. The whole idea revolves around using "mocks" as a noun and not a verb. The concept is to keep parts of the code isolated and easier to test.
20+
- If you want to read more, check out the original blog post (here)[http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/]
21+
22+
## Comprehensions
23+
24+
- Generators:
25+
- are neato
26+
- multiple generators can be used at a time
27+
- Filters can be added to generators as you iterate over an Enum
28+
- Ex. `is_even` => `for x <- 1..10, is_even(x), do: x`
29+
30+
## Strings
31+
32+
- Prolly never gonna need to use Graphemes or Codepoints
33+
34+
## Time
35+
36+
- `Time.utc_now` returns a "Time Struct" `~T[19:39:31.056226]`
37+
- `Date.utc_today` returns a "Date Struct" `~D[2021-02-15]`
38+
- `NaiveDateTime` feels .... useless. Its Date + Time with no timezone /shrug
39+
- I'll prolly most likly use `DateTime` instead.
40+
41+
## Custom Mix Tasks
42+
43+
- Are located in `lib/mix/tasks/*.ex`
44+
- When creating a Task you have to use the macro `use Mix.Task`
45+
- Mix tasks do not autoload dependencies
46+
47+
## iEX Helpers (cool things about the REPL)
48+
49+
- Tab autocomplete
50+
- `.iex.exs` is a local file to configure the repl
51+
- `h Module or Function` renders the docs
52+
- `r Module` will recompile the module
53+
54+
Tada. Day 3. Fin.
55+
If you want to reach out, you can find me on (The Tweeters)[https://twitter.com/basicbrogrammer]

content/articles/using-github-to-crosspost-to-dev-to.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The internet is much like a forest with content and sites being like trees. Ther
1515

1616
<br>
1717

18-
Over the last 6 years of Software Development, I've learned a lot, but I've never shared it outside of my full-time job. If there's not an easy way for people to find the blogs I put out, then I'm still not sharing my thoughts with others. This is where sites like [dev.to](https://dev.to/basicbrogrammer) and [hashnode](https://hashnode.com/@basicbrogrammer) come into play. I can write the markdown for my blog posts in vim then crosspost to other blog distribution platforms. I definitely didn't want to copypasta all my content every time, so I've decided to automate this process and open-source it.
18+
Over the last 6 years of Software Development, I've learned a lot, but I've never shared it outside of my full-time job. If there's not an easy way for people to find the blogs I put out, then I'm still not sharing my thoughts with others. This is where sites like [dev.to](https://dev.to/basicbrogrammer) and [hashnode](https://hashnode.com/@basicbrogrammer) come into play. I can write the markdown for my blog posts in vim then crosspost to other blog distribution platforms. I definitely didn't want to copypasta all my content every time, so I've decided to automate this process and open-source it.
1919

2020
<br>
2121

0 commit comments

Comments
 (0)