teleren/devto huggingface dataset:
24 days of #JavaScriptmas
Tags: javascriptmas, javascript, scrimba
Published: 2020-12-24 19:41:53

I would like to thank #Scrimba for hosting the 24 Days of #JavaScriptmas challenge.  And congratulations to everyone that participated, I hope that everyone had as much fun as I did.  

The following our links to my solutions...   

Day 1: <a href="https://scrimba.com/scrim/coffd4d4db92388687ae2f254">Candies</a>
Day 2: <a href="https://scrimba.com/scrim/coed14e24ab8236eb76ffd703">Deposit Profit</a>
Day 3: <a href="https://scrimba.com/scrim/co04a47128d77403031919f14">Chunky Monkey</a>
Day 4: <a href="https://scrimba.com/scrim/co3684972ae5fb8bc57334bc5">Century From Year</a>
Day 5: <a href="https://scrimba.com/scrim/co7584715a018d41379602a5f">Reverse a String</a>
Day 6: <a href="https://scrimba.com/scrim/cobf840709318d24740f39897">Sort by Length</a>
Day 7: <a href="https://scrimba.com/scrim/cod2a4ce0b6a52ba6e4cb26df">Count Vowel Consonant</a>
Day 8: <a href="https://scrimba.com/scrim/co5bc4335b528a42f4bdfcba2">The Rolling Dice</a>
Day 9: <a href="https://scrimba.com/scrim/co4ca4a70a2739dc46a9465ca">Sum Odd Fibonacci Numbers</a>
Day 10: <a href="https://scrimba.com/scrim/co0964b6d87e56805652ffa7c">Adjacent Elements Product</a>
Day 11: <a href="https://scrimba.com/scrim/co22f42c983a794ff3907751e">Avoid Obstacles</a>
Day 12: <a href="https://scrimba.com/scrim/codfb4ac9a270b009434f88e9">Valid Time</a>
Day 13: <a href="https://scrimba.com/scrim/co42d489789f8e1a8ff109d4b">Extract Each Kth</a>
Day 14: <a href="https://scrimba.com/scrim/co86f49ce964c46a37da0dc5a">Maximal Adjacent Difference</a>
Day 15: <a href="https://scrimba.com/scrim/coaf6489fb792920b5862e54b">Carousel</a>
Day 16: <a href="https://scrimba.com/scrim/co85c435fb8f3a38212b678b9">Insert Dashes</a>
Day 17: <a href="https://scrimba.com/scrim/co758469f9b03648a9e9c8936">Different Symbols Naive</a>
Day 18: <a href="https://scrimba.com/scrim/cobe946a6ba9c638ca444ac2d">Array Previous Less</a>
Day 19: <a href="https://scrimba.com/scrim/coce84dbea2b191605211bfcb">Alphabet Subsequence </a>
Day 20: <a href="https://scrimba.com/scrim/cod1e4db1863347210f9491e7">Domain Type</a>
Day 21: <a href="https://scrimba.com/scrim/coeeb4f2d8ffa7f326f0a2710">Sum of Two</a>
Day 22: <a href="https://scrimba.com/scrim/coc234595b1ead27ebd7a8f78">Extract Matrix Column</a>
Day 23: <a href="https://scrimba.com/scrim/cob4044ce81c2323ef371b196">Social Media Input</a>
Day 24: <a href="https://scrimba.com/scrim/co55e4276bec438337e8d13d8">Test Your Agility</a>

Whew! 

Thanks again to Scrimba and congratulations to everyone that participated in the 24 Days of JavaScriptmas!!

Happy Holidays to you and yours!

Dave
Salmon Run Statistics: Matchmaking (Part 4)
Tags: python, showdev
Published: 2020-12-24 19:28:19

![Rank vs Hazard Level Graph](https://dev-to-uploads.s3.amazonaws.com/i/xraim29asplombjukhf4.png)

Hi y'all.
I'm back with a new post on Salmon Run, this time about matchmaking.

You see that big graph at the top?
That's a scatter plot, with the player rank as the x and the hazard level of the match being the y.
I then placed a linear regression on the graph.
An important consideration of this graph is that I set how much points each title is worth to be 100, as that's how many points you need to move from title to title.

With this graph, the equation of the line is:
> y = 0.111x + 50.691

__________________________________________________________________

As to how I made this graph:
I did it in the [scripts/rank_and_danger_rate.py](https://github.com/cassdelacruzmunoz/salmontracker/blob/dev/scripts/rank_and_danger_rate.py) file.

```Python
data = core.init("All")
x = []
y = []
```
First we prepare the dataset, and create empty lists to store the x and y values.
```Python
with gzip.open(data) as reader:
    for job in jsonlines.Reader(reader, ujson.loads):
        if "title" in job and "title_exp" in job and job["title"] is not None:
            x.append(job["title"]["splatnet"] * 100 + job["title_exp"])
            y.append(float(job["danger_rate"]))
```
Here we collect what we're interested in from the data set.
```Python
plt.scatter(x, y)
plt.xlabel("Rank")
plt.ylabel("Hazard Level")
```
Now we prepare the scatter plot.

```Python
m, b = numpy.polyfit(x, y, 1)
y_equation = list(sorted([x_val * m + b for x_val in x]))
print("y = {:4}x + {:4}".format(m, b))
plt.plot(list(sorted(x)), y_equation)
plt.show()
```
Create and plot the linear regression, and show the graph.
Morphing keyboard
Published: 2020-12-24 19:20:42

My two "directions" in these beginning twilight days are advanced math--learning and teaching--and programming.

As such, it would be helpful to have a programming keyboard that would bring more my special-use keys--e.g., '<' and '>' and the other open-close combinations, ';', '/', '\', the <CTRL>-<CAPS LOCK> swap, etc. into more convenient placement; and, during mathematical duties would have dedicated keys for advanced math symbols and Greek upper- and lower-case letters, etc.

Oh, and because I can't stop myself, the remapped and created keys would display what they are, and the mappings would change "on the fly" with at least the same seemlessness that MS's keyboard mappings do.  (And, yes, I know a sudden switch from US Intl to US Std to Cyrillic can be awkward when unexpected, but I still find it preferable to the repeated install-deinstall-reinstall days of Win 3.1/DOS.)

Finally (for now), I would like the keyboard to cost a user in the low 3-digit range, not anywhere in the 4-digit plus range.  This means I may have to design and code micro LEDs keys from scratch to avoid duplicating patented work.
REST API Design, Development & Management (1)
Published: 2020-12-24 19:01:13

### Hoo-ah! welcome to part one from REST API Design, Development & Management Article series !
***
#### in this series we going throw some API topics like:

* Evolution of RESTful services
* REST API Architectural Constraints
* Designing REST API
* REST API Error Handling Patterns
* REST API Cache Control Pattern 
* REST API Security & Documentation and much more...

***
### So , What is API and what's it's Job ?
`API` is stands for `Application Programming Interface
`,and simply i'd like to say it's a way make some code talk to another throw many ways `send and recive data with kind of data format`. And one of these ways is `HTTP`. 

*** 
In this article we will go throw `Roy Fielding's ` Paper,[Representational State Transfer (REST)] (https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) as our reference .

***
As we mentioned above API is sending and receiving data in kind of data format let's mention the most common two : `XML` & `Json`.
****
Well,Send and receive are two words that humans use , but 
when we deal with an API we use `Request` and `Response`.
Simply clients send Requests to Servers and Servers are Responding to them with Response.

Feeling some gullibility here but why make it complicated!:joy:
 
***
> Hey,We will discuss the anatomy of Api's Requests and Responses later! :eyes:

***

Piece of legacy 
> In 2003 the most common pattern to transfer data between 
> clients and server was in `XML`, it's kind of data format .
> It's called `SOWAP` shortcut for `Simple Object Access 
> Protocol` , it's a good way btw! , But it's major 
> disadvantage was :arrow_right: Heavy on network and slow performance! here where `JSON` has come and take the lead  :fire: .
> and `JSON` stands for `JavaScript Object Notation
`
***

### So, what the difference between `API` and `RESTful API` and what REST stands for !?
Well ,we could say that not every `API` is `RESTful`one ! 

And ? 

And that's it for this part!

***
So,what next ? 
* How APIs work with HTTP.
* Request and Response Architecture
* Answering What is RESTful.
* How to make my API REStful.
* Whats is richardson maturity model ? 

## Thanks ,have a nice time :wink:
Answer Questions and Earn Money on Chegg
Tags: tutorial, career
Published: 2020-12-24 18:54:47

In this article I will show you how to apply for a Q&A expert on **Chegg** and start earning some money.
This article is about how you your knowledge in a subject can lead you to earn some money.

### **What is Chegg?**
Chegg is an website where students can ask questions and get their answers written by an expert. This is where we come in.
We have to answer the question and can make money for each question that we answer.
The money per question can vary, but in India on an average you can get around **₹150 for each question**, which is around 2$.

### **How To Apply**

**Prerequisite** - 
* You should be a undergraduate student or have a undergraduate degree.
* Should have intermediate knowledge of the subject.

**Step 1**: Go to [experthiring.cheggindia.com](https://experthiring.cheggindia.com)

**Step 2**: Signup and accept the guidelines.

**Step 3**: Now proceed for Registration.

**Note:**
_The subject you choose in registration is final 
and cannot be changed, and you will be asked questions on that subject. 
So makeup your mind in advance, 
and then head for registration._

**Step 4**: After completing registration, attempt the test.
Some Notes about the test:
* It has no time limit. Take your time and complete it.
* They will e-mail you the passing criteria.(It was 50% for me).
* There are around 10-12 questions in the test.
* The questions are not very hard, but they do test your basic understanding.

**Step 5**: After the test, DO READ THE GUIDELINES. And only then attempt the guidelines test. It is an easy one but do read the guidelines once. Around 20 questions were asked from me.

### **Conclusion**

After completing the guidelines test, submit all the asked documents and then wait for their email. I got it in 1 day. It will mention the date you can start answering the questions. I applied on December and got the date for February. 
So apply fast, because the seats are limited.
Solving day 24 of Advent of Code 2020 in JavaScript
Tags: challenge, adventofcode, javascript, video
Published: 2020-12-24 18:37:39

---
title: Solving day 24 of Advent of Code 2020 in JavaScript
published: true
description: JavaScript walkthrough of Advent of Code 2020 (day 24)
tags: challenge, AdventOfCode, javascript, video
series: Advent of Code 2020 in Javascript
---

{% youtube 5z2NbsX71TE %}
Typescript vs ReasonML
Tags: javascript, reason, typescript, discuss
Published: 2020-12-24 18:36:34

---
title: Typescript vs ReasonML
published: true
description: 
tags: #javascript, #reasonml, #typescript, #discussion
//cover_image: https://direct_url_to_image.jpg
---

A while ago I ran into this thingie: https://blog.dubenko.dev/typescript-vs-reason/

I started digging into ReasonML and found that I loved it, even more as you can do React with ReasonML.

So I wonder, given all the advantages of ReasonML, how come it's not at least as popular as Typescript?

Edit: ReasonML is supported and created by the same guy that created React.
Dynamically Regrouping QuerySets In Templates - Building SaaS #73
Tags: python, django, templates
Published: 2020-12-24 18:31:45

{% youtube 8uwGj5z7qic %}

In this episode, we worked on a new view to display course resources. While building out the template, I used some template tags to dynamically regroup a queryset into a more useful data format for rendering.

I started a new view before the stream to display content, but I had not filled it in before the stream started.

We added new data to the context, and did some adjustments to the URL based on the required inputs for the view.

Once I had the data, I quickly iterated in the template to see the parts that I included. I needed to display the course resources in a different way from how the queryset provided them so I used the built-in `regroup` template tag to organize the data differently. `regroup` saved me from doing a bunch of manipulation in the view code.

To finish off the feature, I added some automated tests to cement the view so I can be confident in changing it in the future.
24 days of #JavaScriptmas
Published: 2020-12-24 18:30:26

I really enjoyed the whole JavaScriptmas course.
Thank you for this great project.

Day 1:
🍬 JavaScript Challenge: Candies
Solution:
https://scrimba.com/scrim/cod9d4ff5a640553432afb9e2

Day 2:
⭐️ JavaScript Challenge: Deposit Profit
Solution:
https://scrimba.com/scrim/co7de4ca2b6b5098d6c7f5a5e

Day 3:
🧚 JavaScript Challenge: Chunky Monkey
Solution:
https://scrimba.com/scrim/co4ec4e7a829a87bc4c7476f6

Day 4:
🎄JavaScript Challenge: Century From Year
Solution:
https://scrimba.com/scrim/co24f4ea9bd8344d11fa47334

Day 5:
🐑 JavaScript Challenge: Reverse a String
Solution:
https://scrimba.com/scrim/cof1e44f6953949286036df48

Day 6:
🤶 JavaScript Challenge: Sort by Length
Solution:
https://scrimba.com/scrim/coc614ff7a2dced6ab0dd9e9a

Day 7:
🦌JavaScript Challenge: Count Vowel Consonant
Solution:
https://scrimba.com/scrim/co93b41d3aebe0219b36cad1d

Day 8:
🔔 JavaScriptmas Challenge: The Rolling Dice
Solution:
https://scrimba.com/scrim/co3b64da1980e947616d07e30

Day 9:
🎺 JavaScript Challenge: Sum Odd Fibonacci Numbers
Solution:
https://scrimba.com/scrim/coa5348fa9a7863660a2b7fad

Day 10:
💂‍♀️ JavaScript Challenge: Adjacent Elements Product
Solution:
https://scrimba.com/scrim/co6574548bf3ed0e2fed2d9e9

Day 11:
🎁 JavaScript Challenge: Avoid Obstacles
Solution:
https://scrimba.com/scrim/cof3b42a5a90ab98e18856a81

Day 12:
❄️ JavaScript Challenge: Valid Time
Solution:
https://scrimba.com/scrim/co00e430c953a755d42604332

Day 13:
🤴 JavaScript Challenge: Extract Each Kth
Solution:
https://scrimba.com/scrim/co8b348eea71a4ced1320ffd8

Day 14:
🧸 JavaScript Challenge: Maximal Adjacent Difference
Solution:
https://scrimba.com/scrim/cof5a47688bace17aaf03ac87

Day 15:
🕊 JavaScript Challenge: Carousel
Solution:
https://scrimba.com/scrim/co95a4280a355f00f7c155b4f

Day 16:
🧦 JavaScript Challenge: Insert Dashes (Introduction)
Solution:
https://scrimba.com/scrim/co5e64bd6a0063b2bdd96bb0b

Day 17:
👑 JavaScript Challenge: Different Symbols Naive
Solution:
https://scrimba.com/scrim/co91d4c059b26002d61d0da5c

Day 18:
🎅🏻 JavaScript Challenge: Array Previous Less
Solution:
https://scrimba.com/scrim/coe4342edbddd3e5cf87e6205

Day 19:
🐫 JavaScript Challenge: Alphabet Subsequence
Solution:
https://scrimba.com/scrim/cob1f4b309dc1876de2899c30

Day 20:
✨ JavaScript Challenge: Domain Type
Solution:
https://scrimba.com/scrim/coa024b15aac7df21ddb8316f

Day 21:
🦃 JavaScript Challenge: Sum of Two
Solution:
https://scrimba.com/scrim/co65c42739ecd58801acad336

Day 22:
👼 JavaScript Challenge: Extract Matrix Column
Solution:
https://scrimba.com/scrim/co547415facbc3ab178a15061

Day 23:
🌠 JavaScript Challenge: Social Media Input
Solution:
https://scrimba.com/scrim/cobd04acd8748d95541933936

Day 24:
Test Your Agility
Solution:
https://scrimba.com/scrim/coc0b46699a728f74ac31af85
#Day 14: AVL TREE
Tags: 100daysofcode
Published: 2020-12-24 18:21:41

It took me a day to solve the HackerRank question on AVL Tree. I was unable to compare the height difference and the rotation part confused me yesterday. Today I watched lecture on AVL Tree by Abdul Bari and damn I felt like I should have watched it sooner.

I also want to mention that I've started reading the book called "Grokking Algorithms" by Aditya Y. Bhargava. The illustrations really make it quite interesting to read. I have planned to finish it by 31st December,2020 along with getting the golden badge on HackerRank. Once, I'll complete DS from this site, I would move to LeetCode and will start with Codeforce CP. A lot to do next year. Quite a challenge. Let us see how it goes.

Merry Christmas! (I still find Santa fascinating.)
Scrimba Challenge Solutions - 24 of #JavaScriptmas 
Tags: javascriptmas, javascript
Published: 2020-12-24 18:19:02

Day 1
https://scrimba.com/learn/adventcalendar/note-at-0-58-cod384cb3aae30fcfbc8597dc

Day 2
https://scrimba.com/learn/adventcalendar/note-at-1-14-co02f4ce6b62f33e455c7b3c6

Day 3
https://scrimba.com/learn/adventcalendar/note-at-0-50-co3434bef9b40963183c941cd

Day 4
https://scrimba.com/learn/adventcalendar/note-at-1-03-co02041aeae01ce65894481ea

Day 5
https://scrimba.com/scrim/co4194741b7dbd911d1148f01

Day 6
https://scrimba.com/learn/adventcalendar/note-at-0-52-coe5945e8a8a1c567779cd946

Day 7
https://scrimba.com/learn/adventcalendar/note-at-1-25-coe7d40b281e63018625c6801

Day 8
https://scrimba.com/scrim/co82b46b9bbda551766ccfa86

Day 9
https://scrimba.com/scrim/coc84424483d4aceaf6f8aa75

Day 10
https://scrimba.com/scrim/co5e049dcb80d318aec8b436a

Day 11
https://scrimba.com/scrim/co01e4827b3a4d98062d8e20e

Day 12
https://scrimba.com/scrim/co60d483c8b37f181150a7f8e

Day 13
https://scrimba.com/scrim/coa8044248b107e9cf633ca01

Day 14
https://scrimba.com/scrim/coa19453ba37d15f44412fcd8

Day 15
https://scrimba.com/scrim/cof4f452c8e585bee119e6a77

Day 16
https://scrimba.com/scrim/co34e49bfb78cfcf6656b6279

Day 17
https://scrimba.com/scrim/coc8540c4962a49ec382d605e

Day 18
https://scrimba.com/scrim/coe5a4fecb0b127b3880880b9

Day 19
https://scrimba.com/scrim/coae64803a0b1eb9bbe85b9b6

Day 20
https://scrimba.com/scrim/co1354e89abd397b463e43931

Day 21
https://scrimba.com/scrim/coa384752b94ca1c3852afdd1

Day 22
https://scrimba.com/scrim/co3f6417592d876bd38075764

Day 23
https://scrimba.com/scrim/coc074f49ba8de0335015dc2b

Day 24
https://scrimba.com/scrim/co0af4edeb1041c6df6eb8bf8
Javascript and it's execution context
Tags: javascript, executioncontext
Published: 2020-12-24 18:06:51

"Everything in javascript happens inside execution context".

execution context has two part's 
1) Variable environment (Memory)
2) Thread of execution (Code)

Memory: store key : value pair, ex : a = 29;
also store functions with their code ex: fn {...}

Code: is a part where the javascript code gets executed line by line. because javascript is "Synchronous single-threaded language"
Book Review: The Phoenix Project
Tags: books, revew, management
Published: 2020-12-24 17:37:10

This is an amazing book, I recommend it. But when I started the book, after reading the first 20 pages, I wanted to stop reading. Because it looked like another success story, there couldn’t be useful information for me.

But then I started to see the same problems I faced in my technical career as a main character. And more interesting, I did the same steps as the main hero intuitively.

This book describes Bert, who become a new VP of IT operation, and his main goal to run successfully Phoenix project, the project which could save a business.

And in this story, we see a classical company organization, where IT is just a part of an organization, and business makes some money using digital technology, but IT isn’t the main competence of the company. The IT department there looks like an outsourcing company, they serve a business wishlist.

One of the good ideas from the book is to track all types of work that IT operations do. There are 4 types of work: changes, deployments, unwanted. When they started to track work in progress tickets, they saw that they do a lot of unmanaged work. Without a clear justification of unmanaged work, they couldn’t properly measure time to finish a task or project.

They froze all types of work and started creating a clear development and deployment process using Kanban desks. Put together a new cross-functional SWAT team, created scripts to set up the same virtual environments for Dev, QA and Production servers. After that, the operation team permitted developers to build, package, and deploy their code to production servers without involving IT operation guys. Using DevOps culture they accelerated code deployments dramatically and pushed new features for Unicorn project within a day.

Yes, they created DevOps culture, which is: create fast flow from left to right, then to take fast feedback from right to left, and to learn from failure and success.

Also, this book describes bottlenecks in the process and resources. About task priority, doing the right tasks, and measure the right things.

The last idea in the book is that IT is the part of the business and everyone should develop this competency in yourself. It is a must-have ability today.
From Turbolinks to Turbo
Tags: rails, turbolinks, turbo, hotwire
Published: 2020-12-24 17:32:22

I was eager to start using Hotwire in a project that I thought was a perfect fit. Here I will show you what I had to do, to migrate from Turbolinks to Turbo, and keep using Webpacker as main assets bundler.

## Remove turbolinks. Add turbo.

Turbo is basically the new version of Turbolinks, so we need to remove the old npm package and add the new one:

```bash
yarn remove turbolinks
yarn add @hotwired/turbo
```

This will replace the package with the new one.

## Turbo Drive

Turbo Drive is that part of Turbo that replaces the functionalities provided before by Turbolinks.

We need to remove the previous initialization of turbolinks and initialize turbo instead.
In your `application.js` (or wherever you initialized Turbolinks), replace 

```js
require('turbolinks').start();
``` with 

```js
import Turbo from "@hotwired/turbo"
```

With this, you will already have Turbo up and running.

## Replace old Turbolinks code.

The event `turbolinks:load` is now called `turbo:load`. Replace them wherever you are using them.

If you were using `data-turbolinks` attributes, they are now called `data-turbo`. You can replace them as well.

Basically you can search for `turbolinks` within your project and replace it with `turbo`.

## That's it

I started writing this post thinking "This is going to take a while. Such a guide will be useful for sure!". But it ended up being way easier than I thought 😅
In the next posts, I will show you my experiments with Hotwire and Turbo and show how I refactored the code to use the new framework. As of now, Turbo is up and running! 🥳
Pyenv at a glance
Tags: python
Published: 2020-12-24 16:09:36

# What is pyenv?
- Want to have multiple python version ( 2.2.x, 2.3.x, 3.5.x, 3.5.x, etc) without messing with your laptop? Manage virtual env easily? Pyenv is your tool.

# Installing and configuring pyenv 
- https://realpython.com/intro-to-pyenv/#installing-pyenv 

# Some basic commands
## pyenv python version control commands
- `pyenv install 3.6.0` - installs python 3.6.0 in pyenv 
- `pyenv install --list` or `pyenv install --list | grep 3.6`  view all python version `3.6.x` that you can install 
- `pyenv global 3.6.0` - activates/enables 3.6.0 version of python
- `python -V` or `pyenv version -V` to view enabled python 
- `pyenv versions` - list all the python available in pyenv
- `pyenv global system` - will undo the activated python and switch to the python install in your machine/system
- `pyenv local 2.7.18` - will create a .python-version file. We use this command to define folder/project specific python. Basically if you are in this folder, `python` command  will be resolved to `python 2.7.18`. You can also verify it by `pyenv versions`
- We can set python version by 3 ways `pyenv shell 3.8`, `pyenv local 2.7.18` and `pyenv global 3.5.9`

## pyenv virtualenv commands
- `pyenv virtualenv <python_version> <env_name>` - eg `pyenv virtualenv 3.5.9 my_env` - will creates a python env with `my_env` name
- activate this newly created env - `pyenv activate my_env`
- if you want to automatically activate this env after navigating to a project folder if do `pyenv virtualenv 3.5.9 my_env` > `navigate to project` > `pyenv local my_env` > will create `.python-version` file with content `my_env` so that `pyenv-virtualenv` plugin will know that you have already an env for this folder and activates this. Navigating out of this folder will deactivate the env
- It also supports multiple env at once. `pyenv local env1 env2` - command will try to be resolved in env2 if failed then it will use env2 

## conclusion
- You have multiple python versions
- No need to activate env for projects manually