teleren/devto huggingface dataset:
React Rendering & Commit phases
Tags: webdev, javascript, react, tutorial
Published: 2023-11-12 18:50:31

## Context
This post is part of my post series that complements the ["Build your own React" tutorial by Rodrigo Pombo](https://pomb.us/build-your-own-react/).

## In this post...
In step 5, Rodrigo introduced the rendering and commit phases, but the distinction and the role of each phase was not clear. Let's change that!

## What happens when a React program runs?

Remember these first lines in the tutorial?

```js
1 | const element = <h1 title="foo">Hello</h1>
2 | const container = document.getElementById("root")
3 | ReactDOM.render(element, container)
```

After you have implemented the entire Didact library, the above three lines will:

1. Build a new virtual DOM, which is basically a tree whose nodes are elements created from `createElement` (line 1).
2. Compare the nodes in the virtual DOM with the corresponding fibers in the current fiber tree in the `reconcileChildren` function (officially called `diffing` by React team). The result of this process is...
3. A new Fiber that contains the message denoting to the commit phase what to do with it (`effectTag`), and the necessary data to perform that action.
4. These fibers are sent to the `commitRoot` function to be reflected into the real DOM.

The first 3 steps belong to the rendering phase, while the last step is the commit phase. So, the rendering phase includes:

- Rendering the virtual DOM
- Reconciliation / Diffing between the wip and current tree
- Preparing data for the commit phase

## Notes on the use of the word "rendering"

If you go on and read more posts about React internals, you will see people abusing the word "rendering". They say:
- Rendering vs. commit phase (as in Rodrigo's language)
- Rendering the virtual DOM
- Rendering the real DOM (i.e the commit phase)

... so just be on the look out for that.

## Notes
Notice how the Fiber is only used in the rendering phase. That means while the browser can temporarily put on hold the rendering phase to work on other high-priority tasks, the commit phase cannot be interrupted.
Late Hacktoberfest Part lV
Published: 2023-11-12 18:35:23

## Final Contribution

This is a post about my fourth and final contribution for this series. I am happy that I reached the goal of 4 contributions at the end. For my final contribution I wanted to work on a web application. First, I chose an issue that was about creating code syntax highlighting for a code translator application, when I started to work on this project I was having a lot of issues trying to get it to work because of the libraries I was trying to use and since I had spent a couple of days trying to get it to work and did not have enough time, I had to move on and choose a simpler web app issue to work on. But, I plan on going back to that project to keep working on it. So, I chose this [issue](https://github.com/TechStarHub/quotes/issues/2). For this issue, the project owner wanted to implement a back-end functionality for his web application that was in charge of getting and sending a random quote from a data set and responding to the route associated with it. So, for the fourth time I reached out to be assigned the issue and started to work on it after I forked the repo.

## Implementation

The implementation for this issue was easy. I created a function that located and read the json data file filled with quotes and I used "fs" and "path" modules to achieve that. After I read the file I parsed the json data and used the Math library to get a random index, then returned a random quote out of all the parsed quotes based on the random index that I had generated. Afterwards, I set up the app.get() method with the correct route for it, called the function I had created to retrieve a random quote inside it and returned it as a json response. I tested everything and made sure that everytime the route was called a new random quote was generated. After I was satisfied that everything was working and I did not break anything I committed my changes and created a [PR](https://github.com/TechStarHub/quotes/pull/4).

## What I learned

Even though I didn't get to fix the original issue that I had picked for my final contribution due to time constraints, I still plan on going back and working on it on my own time, because it piqued my interest. As for the issue I worked on, it was a nice review on express and back-end implementation. A new thing I learned though was not code related, it was Github related. When I was submitting my PR I saw that the project owner had set up their own PR form as a template, which was very interesting. This was the first time I had encountered a custom PR template when submitting one. I will consider using a custom PR template for my own projects, since it allows for more customization and organization of the PR details.
Software Dev is a Drug
Tags: programming, career, coding
Published: 2023-11-12 18:31:54

View a tl;dr on [Substack](https://cmdfang.substack.com/p/software-dev-is-a-drug)

I vividly remember having a 1-1 with a past manager who was taking an extended period of time away from work. When asked about what he planned on doing during his vacation, he replied: “I want to experiment with SwiftUI for iOS app development.”

Writing code is one of the few professions where people spend their free time _writing more code._ This observation has always been puzzling. One would think that after 40+ hours of staring at a computer, the last thing someone would want to do is to continue ruminating over lines of code. 

**Why is this the case?**

In many ways, software development piggybacks on the same addictive mechanisms that make social media and recreational drugs so appealing.

Feedback loops in software development are insanely fast. In more “traditional” mechanical / electrical engineering, it could take months (if not years!) to create a prototype from an initial idea. With software, it could be a matter of hours (if not minutes!). This creates an endless flow of  dopamine hits, not unlike the feedback loop of mindlessly scrolling TikTok for the next interesting video.

Creating a solution through code is rewarding, yet often uncertain. You don’t know for sure whether a specific change will fix a bug, or whether your code will compile after 30 minutes of hard work. This uncertainty, when paired with periodic success, is a powerful motivating factor. The phenomenon is termed the “unexpected rewards principle” and is well-known within human and animal psychology.

And lastly, we know too well the satisfaction of achieving “flow” while coding. While incomparable to cocaine-induced euphoria, the allure of effortless productivity is undeniably attractive.

If software development is so addictive, then perhaps we should treat it with the same level of caution that we do with any other indulgence.

I’ve come to realize that it’s important to be mindful of the time that I spend developing software. By clearly defining my boundaries and finding hobbies unrelated to my profession, I’ve not only become happier, but also more productive during my time spent writing code.
React Fiber tree
Tags: webdev, javascript, react, tutorial
Published: 2023-11-12 18:26:30

## Context
This post is part of my post series that complements the ["Build your own React" tutorial by Rodrigo Pombo](https://pomb.us/build-your-own-react/).

## In this post...
In step 4, Rodrigo introduced the Fiber architecture. However, he didn't relate Fiber to the bigger picture of React. This post will review what Fiber is, what its purpose is, and how this concept relates to Virtual DOM.

## What is Fiber?

Fiber tree is a tree data structure, where each node is a Fiber. A Fiber is an object that has the following properties:

```ts
interface DidactElementProps {
	[key: string]: any;
	children: DidactElement[];
}

interface DidactElement {
	type: string | Function;
	props: DidactElementProps;
}

interface Fiber extends DidactElement {
	parent: Fiber;
	sibling: Fiber;
	child: Fiber;
	dom: HTMLElement | Text;
	alternate: Fiber;
	effectTag: string;
}
```

What can make Fiber confusing is the fact that the object encompasses so much information. Let's break it down:


- (Information of) the virtual DOM: `type` and `props`
- The actual DOM node: `dom`
- Its connection to the tree: `parent`, `child`, `sibling`
- The corresponding fiber in the previous render: `alternate`
- Message to the commit phase on what to do with this Fiber: `effectTag` (update/delete/insert into the DOM)

A Fiber node represents either a DOM node (`h1`, `div`, `p`, etc.) or a function that corresponds to a functional component.

## Purpose of Fiber tree

It enables us to break down the rendering phase into small units of work, each of which corresponds to a Fiber in the tree. The browser decides the number of work units/fibers it works on before it has to leave the rendering and come back later because it has a higher priority task awaits.

## Fiber and Virtual DOM

In Rodrigo's tutorial, the Fiber tree "acts" as a virtual DOM.

In the first code snippet:

```js
1 | const element = <h1 title="foo">Hello</h1>
2 | const container = document.getElementById("root")
3 | ReactDOM.render(element, container)
```

The first line creates the actual virtual DOM, which is passed into the `render` function. Down the line, in `reconcileChildren` (in step 5), the `type` and `props` of each node in the virtual DOM are deconstructed and initiated as the type and props of a fiber.

Mentally, we can think of it as the Fiber tree is a physical representation of the virtual DOM or the Fiber tree acts as a virtual DOM.

## Deeper read

https://github.com/acdlite/react-fiber-architecture
All {M3 MacBook Pro} configs: Ranking by Compute/RAM/SSD per $
Tags: apple, macbook, development, hardware
Published: 2023-11-12 18:12:46

It's been almost a week since new M3 MacBook Pro have been released. There's plenty of reviews on YouTube discussing the new black colour, counting CPU cores and testing performance.

Though in [this video](https://www.youtube.com/watch?v=ZPd2v3dteUc) the author has shared a Google Spreadsheet with specs and prices for all 83 configurations available for purchase. Some of the specs included RAM and SSD sizes, Geekbench CPU score.

"What is the value for a buck?" popped in my head. Right away I cloned the spreadsheet and started playing with formulas. Here's my take on **value for money** in different categories:

| Category          | Inches | Proc   | P Cores | E Cores | RAM | SSD  | Geekbench6 multi core score | Price  |
| ----------------- | ------ | ------ | ------- | ------- | --- | ---- | --------------------------- | ------ |
| Best compute/$    | 14     | M3     | 4       | 4       | 8   | 512  | 11763                       | $1,599 |
| Best RAM/$        | 14     | M3 Max | 12      | 4       | 128 | 512  | 21215                       | $4,499 |
| Best SSD/$        | 14     | M3 Max | 10      | 4       | 36  | 8192 | 18519                       | $5,399 |
| Best everything/$ | 14     | M3 Max | 10      | 4       | 96  | 8192 | 18519                       | $6,199 |
| Most expensive    | 16     | M3 Max | 12      | 4       | 128 | 8192 | 21215                       | $7,199 |


- For the best "compute", "RAM" and "SSD" I divided Geekbench multicore score, RAM amount and SSD size (correspondignly) by the model price and sorted with largest value at the top.
  - I.e. **Best RAM/$** was the model that scored 7.35 MB/$ and was at the top of the list.
- For the "Best in everything" I used an aggregate score that first normalised each of the 3 columns (CPU, RAM, SSD) and then averaged them and divided by price.

[Here's the spreadsheet](https://docs.google.com/spreadsheets/d/16WOQfNT-uDGzxBUO8b3NAqToQTyyqaiZVZ9HckNHa8s/edit?usp=sharing)

## Disclaimer/considerations
- This is more of a thought experiment rather than a holistic testing
- More is better is valid for RAM and SSD, while for 14" vs 16" might not be the case
  - E.g. I am writing this article on 14" MBP and value it's compact size more
- There's [a review](https://www.youtube.com/watch?v=hmWPd7uEYEY) that suggests that 8GB M3 base model is significantly inferior to bigger models even in CPU department as soon as you start multitasking and consume some of the RAM
🎰 Returnbet - 즐거운 카지노 경험과 풍부한 혜택이 여러분을 기다립니다! 🎰
Published: 2023-11-12 18:12:11


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nbb0jbpxdo7quvvgdlty.jpg)

🌟 매일 카지노 첫충 프로모션 5% 지급! 🌟 Returnbet에서는 카지노 첫충전마다 5%의 보너스를 지급하고 있습니다. 절호의 기회를 놓치지 마세요!

🎉 새벽 첫 충전 5% 지급 이벤트 진행 중! 🎉 새벽에 첫 충전 시, 추가로 5%의 보너스를 더 지급하는 특별한 이벤트를 지금 바로 즐겨보세요.

⏰ 티타임 이벤트로 쿠폰이 지급되고 있어요! ⏰ Returnbet은 티타임 이벤트로 다양한 쿠폰을 지급하고 있습니다. 더 많은 혜택을 누리세요!

🎲 에볼루션 카지노, 플레이텍 카지노 이용 가능! 🎲 Returnbet은 에볼루션 카지노와 플레이텍 카지노를 통해 다채로운 게임을 즐길 수 있습니다.

🎮 bet365 미니게임과 스포츠 라이브배팅으로 멀티 배팅 가능! 🎮 Returnbet은 bet365의 미니게임과 스포츠 라이브배팅으로 다양한 멀티 배팅을 즐길 수 있는 플랫폼을 제공합니다.

🕒 매일 오후 티타임 이벤트도 놓치지 마세요! 🕒 Returnbet은 매일 오후에도 다양한 이벤트를 통해 특별한 혜택을 제공하고 있습니다.

✅ 롤링 100% 이후 정상 출금 가능! ✅ Returnbet은 모든 롤링 100% 이후 정상 출금이 가능한 안전한 메이저 사이트입니다.

🔗 지금 Returnbet에서 특별한 혜택을 누리세요! 👉 Returnbet 가입 바로가기 (가입 코드: A T)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jnj8tawiedgol8mmgukk.jpg)
Alpha 1.0.2
Tags: alpha
Published: 2023-11-12 17:59:28


**High Priority**

1. 3 new Greatsword attacks
   1. Right Click does a charging stab
   1. Shift attack after 1st basic attack rotates the player around the enemy
   2. Shift attack after the above shift attack makes the player jump in the air for an execution-style attack
1. 1 new Sword attack
   1. Right click make the player flip forward and attack
9. Implemented Auto Save
   1. Auto Save now happens every time the player leaves combat
9. Added "Load Auto Save" option to UI
10. Add Keybind documentation for Skin Writing Ability
11. Player will stop using potion when full health is reached
12. Player can no longer drink potions while interuptted
13. Added a death animation layer so that it will override all other animation layers and prevent the player from animating after death
3. Player's Head IK no longer looks at random spots on the ground
5. Update UI for Character panel
6. Update UI for Crafting to make it more intuitive




**Medium-High Priority**

1. Consumable Toolbelt (ex: Potions) now shows a number of how many consumables are left
   1. The toolbelt UI will gray out when consumable count is 0
2. Unequipping an item that is active and equipped will unequip it from the player
3. Equipping a weapon will not affect the equip state of an unrelated active weapon
5.  Damage text is now more animated (although it still needs work)
6.  Greatsword is now utilizing colliders for collision detection instead of the old raycast web method


**Medium Priority**

3. (Prototyping) Add music when combat begins for Golem
4. Fix Shadows on Firepit
Late Hacktoberfest Part lll
Published: 2023-11-12 17:51:43

## Third Contribution

C++ was the first coding language I learned and it has been some time since the last time I used it for any of my projects. So, for my third contribution I decided to contribute to a C++ project just to see if I am still capable of utilizing the language and the tools it offers. I searched for a C++ issue on Github and decided to work on this [issue](https://github.com/NikolaBV/Console-Spendings-Calculator/issues/33). The project owner wanted to create a functionality for his expenditure tracking console application that went though a spendings csv file for a day and calculated the total amount spent for that day. So I reached out to the owner to assign me the issue and began to work after I was assigned to it.

## Implementation

I forked the the repository, created a new branch for the issue and started to work on it. For the implementation I decided to create 3 different functions:

1. A function that was in charge of reading a CSV file and retrieving the data in it as a vector type. This function took a reference to a file path as a parameter and returned a vector of data from the file. The screenshot of the function can be found below: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8vhbpw81brbvufp1kzx.png)

2. A function that was in charge of going through the data returned from the previous function and took a reference to that data and a column name reference as parameters. This function went through the vector of data and looked for the index of a specific column based on its name. After finding it's index it went through all the values associated with that column based on the index found, saved all the values in a vector and returned them. This screenshot shows this function: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jj7cxwj8h2jc38bxj5iw.png)

3. A function that took a reference of all the values returned from the previous function and calculated the sum of all of them. Since I have used vectors to store all my data, I decided to use the Algorithm library and utilize transform() and accumulate() functions from it. I used transform and lambda expression to change the type of the values from string to double and used accumulate to get the sum of all the double values. This screenshot shows the implementation: 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3yfvbxwhaganjoy3grvv.png)

After I implemented all the functions and tested them out to make sure everything worked. I committed my changes and created a [PR](https://github.com/NikolaBV/Console-Spendings-Calculator/pull/41). 

## What I Learned
I learned that I can still code in C++ even though it has been a few years since the last time I used it. I had to go over the documentation for the algorithm library again to review how transform() and accumulate() functions worked. So, overall this was a nice review on a language I haven't used in a long time and it rekindled some old knowledge for me.
Hacktober Maintainer -2023
Tags: hack23maintainer
Published: 2023-11-12 17:49:16

As a proud participant in **Hacktoberfest**, I am excited to contribute as a maintainer to open-source projects. Being a maintainer during Hacktoberfest is not just about receiving contributions but fostering a collaborative community. I welcome developers to join me in making impactful contributions, whether it's fixing bugs, adding new features, or improving documentation. Together, we can make a difference in the open-source landscape. Join me on this journey of collaboration, innovation, and giving back to the community!
Hacktober Contributor
Tags: hack23contributor
Published: 2023-11-12 17:44:20

**Hacktoberfest 2023 Contributor**

I am thrilled to have actively participated in Hacktoberfest 2023, contributing to open-source projects and engaging with the global developer community. During this exciting event, I collaborated on diverse projects, enhancing my skills and making meaningful contributions to the world of open source. It was an enriching experience, and I look forward to continuing my journey of learning and collaboration in the vibrant open-source community.
Buy Verified Stripe Account
Tags: stripeaccount, stripeaccoutforsale, buystripeaccount, topsmmaccount
Published: 2023-11-12 17:37:24

Buy Verified Stripe Account

[Buy Verified Stripe Account](https://topsmmaccount.com/product/buy-verified-stripe-account/
)- Old verified with transaction

[Buy Verified Stripe Account](https://topsmmaccount.com/product/buy-verified-stripe-account/
) from TopSmmAccount :- Your trusted partner for seamless online payments and financial transactions. Old verified stripe

Replay and contact 24/7 Live Support

E-mail : topsmmacount@gmail.com
WhatsApp : +1(315) 514-9654
Telegram : @topsmmaccount
Skype : topsmmaccount
twitter : @topsmmaccount


https://topsmmaccount.com/product/buy-verified-stripe-account/

https://www.youtube.com/@topsmmaccount/featured

#topsmmaccount
#buy_verified_stripe_account
#verified_stripe_account
#old_verified_stripe_account
#verified_stripe_buy
#old_stripe_account_online
Buy Clutch Reviews
Tags: buyclutchaccount, clutchreviews, topsmmaccount, websitereveiws
Published: 2023-11-12 17:34:20

[Buy Clutch Reviews
](https://topsmmaccount.com/product/buy-clutch-reviews/
)
Discover how TopSmmAccount.com can boost your online reputation with authentic Buy [Clutch Reviews](https://topsmmaccount.com/product/buy-clutch-reviews/
). Elevate your business trust and credibility

Replay and contact 24/7 Live Support

E-mail : topsmmacount@gmail.com
WhatsApp : +1(315) 514-9654
Telegram : @topsmmaccount
Skype : topsmmaccount
twitter : @topsmmaccount

https://topsmmaccount.com/product/buy-clutch-reviews/

https://www.youtube.com/@topsmmaccount/featured

#Buy_Clutch_Reviews
#Clutch_Reviews_buy
#Clutch_Reviews
#topsmmaccount
#website_reviews
#google_5star_reviews
#google_reviews
BONUS: Diwali
Tags: webdev, frontend, 100daysofcode, diwali
Published: 2023-11-12 17:30:00


## Question

Make a bit of HTML and CSS code that, when clicked, unleashes a Diwali cracker as below.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yr2f3tep79doitr5xjmv.gif)

**Hint**: We'll use the canvas to show the ignite effect.

Check the comment below to see answer.
Elevate Your Research Game with Cutting-Edge Peptides!
Tags: healthydebate, html, javascript, css
Published: 2023-11-12 17:29:18



Hello fellow researchers,

Embark on a scientific journey with a game-changer I recently uncovered – a haven for top-tier research peptides. Dive into a world of quality, transparency, and innovation at[Buy Gonadorelin Peptide For Sale Today](https://buypeptidesonlineusa.com/buy-gonadorelin-peptide-for-sale-online/ ) . This platform has become my secret weapon for sourcing meticulously crafted peptides, perfect for pushing the boundaries of my research.

Navigating peptide synthesis or staying abreast of biochemistry breakthroughs has never been more seamless. The platform's intuitive design and comprehensive product insights ensure you're armed with knowledge before making any decisions.

Join me in the pursuit of scientific excellence and check out this invaluable resource. Trust me; your research deserves it!
Test
Tags: test
Published: 2023-11-12 17:23:58

Hello world

---

```
อะไรเนี่ย
```
`asdf`
| Hello | col1 |
| -- | -- |
|1 | 2 |

|  Hello | world  | col3 |
|--|--|--| 
| asdf | asf2 | 3 |

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3ywpmdu0417ai09jz4x.jpeg)
Статья о сериале "Молодёжка"
Published: 2023-11-12 17:18:43



Сериал "Молодёжка" - это популярный российский телесериал, который рассказывает о жизни и приключениях молодых хоккеистов. Он был создан в 2013 году и с тех пор завоевал огромную популярность у зрителей разных возрастных категорий.

В сериале "Молодёжка" показано множество тренировок, хоккейных матчей и соревнований. Главные герои - молодые хоккеисты, которые стремятся достичь успеха в своей спортивной карьере. Их жизнь полна эмоций, сложностей и радостей, а каждый эпизод сериала наполнен напряженной атмосферой и драматическими поворотами событий.

Важной составляющей сериала является хоккей. Этот вид спорта играет ключевую роль в жизни героев, формируя их характеры, участвуя в различных конфликтах и создавая динамичную сюжетную линию. Если вы интересуетесь хоккеем, рекомендуем посмотреть этот короткий ролик на YouTube: [хоккей](https://youtube.com/shorts/BPudQUwjiD0?feature=share).

Сериал "Молодёжка" также известен своей захватывающей сюжетной линией и непредсказуемыми поворотами. Если вы еще не видели сериал, то рекомендуем вам ознакомиться с ним на YouTube: [молодёжка](https://youtube.com/shorts/t1qJjZ7iFdo?feature=share). Это отличный шанс окунуться в мир спорта и эмоций, который представлен в сериале.