# Code you love - share yours!

**URL:** <https://forum.devtalk.com/t/code-you-love-share-yours/140017>\
**Category:** General Dev Chat\
**Tags:** community, aesthetics, functionality\
**Created:** [17 January 2024 22:56 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017 "2024-01-17T22:56:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [17 January 2024 22:56 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/1 "2024-01-17T22:56:24Z")

</div>

Thought this would be a nice way to start the year - have you seen or written a function (or method) or piece of code that you are particularly fond of? Perhaps you admired its simplicity (or complexity!) or maybe your surprised yourself or surpassed your own expectations of what is possible?

Whatever the reason, please share! 😊

---

<div class="post-metadata">

**Author:** ![ragamuf](https://forum.devtalk.com/user_avatar/forum.devtalk.com/ragamuf/32/4362_2.png) [@ragamuf](https://forum.devtalk.com/u/ragamuf)\
**Post date:** [22 January 2024 15:33 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/2 "2024-01-22T15:33:32Z")

</div>

Hey Ashton, when GenStage was first released I wanted to make something practical with it in Elixir and ended up writing my own job manager. Then later I found a use case for this code which was sitting on the shelf. Felt pretty sweet.

---

<div class="post-metadata">

**Author:** ![dyowee](https://forum.devtalk.com/user_avatar/forum.devtalk.com/dyowee/32/6692_2.png) [@dyowee](https://forum.devtalk.com/u/dyowee)\
**Post date:** [23 January 2024 06:49 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/3 "2024-01-23T06:49:33Z")

</div>

This sounds great. This will help a lot of junior developers like myself.

---

<div class="post-metadata">

**Author:** ![jaeyson](https://forum.devtalk.com/user_avatar/forum.devtalk.com/jaeyson/32/6395_2.png) [@jaeyson](https://forum.devtalk.com/u/jaeyson)\
**Post date:** [25 January 2024 02:33 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/4 "2024-01-25T02:33:44Z")

</div>

When i started freecodecamp but using Elixir. The language helped me understand recursions and told me to forget hoisting and other quirks with JS (except closures).

---

<div class="post-metadata">

**Author:** ![ohm](https://forum.devtalk.com/user_avatar/forum.devtalk.com/ohm/32/559_2.png) [@ohm](https://forum.devtalk.com/u/ohm)\
**Post date:** [25 January 2024 20:57 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/5 "2024-01-25T20:57:06Z")

</div>

I’ve always admired the fast inverse square root function from Quake III Arena:

```cpp
float q_rsqrt(float number)
{
  long i;
  float x2, y;
  const float threehalfs = 1.5F;

  x2 = number * 0.5F;
  y = number;
  i = * ( long * ) &y; // evil floating point bit level hacking
  i = 0x5f3759df - ( i >> 1 ); // what the fuck?
  y = * ( float * ) &i;
  y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
  // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed

  return y;
}

```

This functions is called millions of times in that game, because you need to do inverse square roots to do graphics.

There’s a good write up on it’s history and meaning on [Wikipedia](https://en.wikipedia.org/wiki/Fast_inverse_square_root).

---

<div class="post-metadata">

**Author:** ![ragamuf](https://forum.devtalk.com/user_avatar/forum.devtalk.com/ragamuf/32/4362_2.png) [@ragamuf](https://forum.devtalk.com/u/ragamuf)\
**Post date:** [30 January 2024 14:02 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/6 "2024-01-30T14:02:43Z")

</div>

Hey @AstonJ, thanks again for this thread. It motivated me to dust off an article I had sitting as a draft and finally publish it. [Roll your own Queue Processor in Elixir with GenStage](https://forum.devtalk.com/t/roll-your-own-queue-processor-in-elixir-with-genstage/141703)

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.devtalk.com/user_avatar/forum.devtalk.com/kokolegorille/32/575_2.png) [@kokolegorille](https://forum.devtalk.com/u/kokolegorille)\
**Post date:** [30 January 2024 22:08 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/7 "2024-01-30T22:08:15Z")

</div>

I was very proud when I translated Joe Armstrong’s tetris from Erlang to Elixir 🙂

---

<div class="post-metadata">

**Author:** ![gflashner](https://forum.devtalk.com/user_avatar/forum.devtalk.com/gflashner/32/6665_2.png) [@gflashner](https://forum.devtalk.com/u/gflashner)\
**Post date:** [31 January 2024 00:35 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/8 "2024-01-31T00:35:12Z")

</div>

Such low level stuff I don’t understand 😃

---

<div class="post-metadata">

**Author:** ![jaeyson](https://forum.devtalk.com/user_avatar/forum.devtalk.com/jaeyson/32/6395_2.png) [@jaeyson](https://forum.devtalk.com/u/jaeyson)\
**Post date:** [11 February 2024 03:52 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/9 "2024-02-11T03:52:01Z")

</div>

wow! bookmarked! 👌🏾

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [13 February 2024 02:53 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/10 "2024-02-13T02:53:22Z")

</div>

Make it a LiveView or ECSx app and put it on the web Koko! :023:

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.devtalk.com/user_avatar/forum.devtalk.com/kokolegorille/32/575_2.png) [@kokolegorille](https://forum.devtalk.com/u/kokolegorille)\
**Post date:** [17 February 2024 02:18 UTC](https://forum.devtalk.com/t/code-you-love-share-yours/140017/11 "2024-02-17T02:18:54Z")

</div>

I already wrote the plugin… it is available here

> **[GitHub - kokolegorille/tetris\_logic: tetris game logic in Elixir](https://github.com/kokolegorille/tetris_logic)**
>
> tetris game logic in Elixir. Contribute to kokolegorille/tetris\_logic development by creating an account on GitHub.

But it is old code, it’s when I started Elixir 🙂
