teleren/devto huggingface dataset:
Make Fathom Analytics work with Turbolinks / Turbo in your Rails project
Tags: rails, analytics, turbolinks
Published: 2021-06-16 19:45:38

If you have Turbolinks or Turbo in your Rails project, only the first page view would be counted and tracked by Fathom Analytics. Here is how you can make use of `load` event to track the page views.


For turbolinks:
```js
document.addEventListener("turbolinks:load", function() {
  if (window.fathom) {
    window.fathom.trackPageview()
  }
})
```

For turbo:
```js
document.addEventListener("turbo:load", function() {
  if (window.fathom) {
    window.fathom.trackPageview()
  }
})
```
---

I had recently confirmed the same with Fathom team:

{% twitter 1376209437094895620 %}
and looks like this is the way to go:
{% twitter 1376210757218562053 %}
Finally, I launched my super tiny side project! Drop.in , a browser extension for job seekers! 🚀
Tags: javascript, browser, html, css
Published: 2021-06-16 19:24:27

Hey Dev's!

Finally, I am getting out of my comfort zone to start working on a few projects I always had in mind. 😅

From September - December 2020, I was applying for my first Software Engineering job. It took me a little bit over 400 applications to get it. 😔 Something I noticed: Most companies require you to **"upload your Resume"**, but still **require you to fill out all the forms.**

This was a pain, a personal pain. In a world where A.I, Machine Learning, and all the other futuristic topics are trending, how in the world do I need to type my information over and over. But, life happened and I let it go.

On June 6th, 2021, I saw a post on Reddit with 1.7k upvotes. The complaining was exactly my pain a few months back: why companies ask for your resume and then have you type all the information again! 🤯

I decided to take action! It took me 3 days to finish a simple version where **you can type once, and then, just drag 'n drop everywhere.** A browser extension for Chrome and Firefox (It also works with Brave).

Meet: [Drop.In - a Browser Extension for job seekers!](http://dropin.versoly.page/)

Now the goal is to make sure it is useful! Looking for all feedback possible! 👍🏻

###What I learned about building browser extensions:
* You can use plain and simple HTML, CSS, and JS (As well as other frontend frameworks).

* You can make API calls.

* 5$/one-time fee to create a dev account on the Chrome Webstore and it is free for Firefox.

* You can build for Chrome and maybe you just need a few twists to make it work for Firefox.

* The [Getting Started](https://developer.chrome.com/docs/extensions/mv3/getstarted/) from Google is pretty good!

* It also works for Chromium-based browsers (So, building for Chrome will also make it work in Brave, for example)
Key Takeaways From My First JS Project
Tags: javascript, beginners
Published: 2021-06-16 19:21:45

Asynchronous requests allow our code to multi-task.

A fetch() request has three statuses; Promise, Response, & Error. 

-The promise is the HTML API source.

-The Response is the data from the source.

-Error occurs when no response is returned.

An EventListener takes an action ("click", "submit") and a callback function written as arrow function (()=>{}). 

Function() should only be used when it is the start of the code otherwise ES6 is standard (i.e arrow function).

Know your data! 

When you change one thing make sure you go through and restructure anything else that references that original location where the change was made. I found myself iterating through one object over and over again with a forEach statement, which I had written initially for an API with multiple objects.

Know your code!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3v4yhtcfnu0pmmr05rm.png)
Home automation with Lars Richter
Tags: discuss, podcast, hardware
Published: 2021-06-16 19:09:55

---
title: Home automation with Lars Richter
published: true
description: Listen to S5E6 of DevDiscuss!
tags: discuss, podcast, hardware
series: DevDiscuss Season 5
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvb8ej53rw2cmn00ou9s.png
---

This week on the show, you'll meet a new guest co-host, [Jamie Gaskins](https://dev.to/jgaskins). @jgaskins is the Principal Site Reliability Engineer at Forem. We are very lucky to have Jamie helping us make Forem scalable and highly reliable ✨ 

On this week's episode, we talked about something that _is_ very nerdy but _isn't_ directly related to either of our work. In other words, we had a lot of fun with this. 


{% podcast https://dev.to/devdiscuss/s5-e6-home-automation-nerd-out %}

 
Our guest this week was **[Lars Richter](https://twitter.com/n_develop), Application Developer at Parship Group.** I have been excited to chat with Lars about all things home automation for a while now and he did not disappoint!

As I describe in the episode, I am really fascinated by home automation — so much so that I created a new Forem community dedicated to this topic called [Hometechnica](https://www.hometechnica.com/). I hope you'll take a look and consider joining!

Take a listen to DevDiscuss S5E6 to hear us define, nerd out, and complain about home automation. 
 

---

_You can [follow DevDiscuss](dev.to/devdiscuss) to get episode notifications and listen right in your feed_ — or subscribe on your platform of choice! Plus, if you leave us a review, we'll send you a free pack of thank-you stickers. Details [here](https://airtable.com/shr8oKAIMZgdYnBxx). 

## Quick Listening Links
- [Apple Podcasts](https://podcasts.apple.com/us/podcast/s5-e6-home-automation-nerd-out/id1513053883?i=1000525725291)
- [Spotify](https://open.spotify.com/episode/0GZkjHIl0ZGfdpaCxUHWCA)
- [Google](https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5kZXZwb2RzLmRldi9kZXZkaXNjdXNzX3BvZGNhc3QueG1s/episode/aHR0cHM6Ly9kZXZwb2RzLmRldi9wb2RjYXN0cy9kZXZkaXNjdXNzLzM5?sa=X&ved=0CAQQkfYCahcKEwjYquuH7ZzxAhUAAAAAHQAAAAAQCA)
- [Listen Notes](https://www.listennotes.com/podcasts/devdiscuss/s5e6-home-automation-nerd-out-dHfmCZM-nK6/)
- [TuneIn](https://tunein.com/podcasts/Technology-Podcasts/DevDiscuss-p1324596/?topicId=163810390)
- [RSS Feed](http://feeds.codenewbie.org/devnews_podcast.xml)
- [DEV Pods Site](https://devpods.herokuapp.com/podcasts/devdiscuss/episodes/171)

---
_Acknowledgements_ 
- _@levisharpe for producing & mixing the show_
- _Our season five sponsors: [CockroachDB](cockroachlabs.com/devdiscuss), [Cloudways](https://www.cloudways.com/en/?id=893892), [Scout APM](https://www.scoutapm.com/devdiscuss) & [Rudderstack](https://rudderstack.com/?utm_source=devto&utm_medium=podcast&utm_campaign=CMPGN_3_PS&utm_content=None&utm_term={keyword}&raid=6dbc05eeb293b421f68d02ce12648240)!_

# 🗣️🗣️🗣️
GIT Basics Course / Cheatsheet
Tags: git, tutorial, productivity, webdev
Published: 2021-06-16 18:50:40

## What is GIT?

Best short and also official description:

> Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Benefits / Comparison:

> Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

## Setup

Download and install it from [https://git-scm.com/](https://git-scm.com/)

## GIT Commands

### Basic Commands

```
git status // Show the current status
git init // Initialize project folder with GIT
git add // Add changes to the stage
git commit // Commit changes in the stage to the history / log
git log // Show the commit history
```

### GIT Help

```
git help // Help Overview
git help -a // GIT Commands
git help -g // GIT Guides
```

### GIT Branching visually illustrated

![GIT Branching](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8pu5h21m48akfpolc913.png)

### Branching Commands

```
git branch // Create a branch
git checkout (in future "git switch") // Switch to a branch
git merge // Merge a branch into an other one
```

Playground for GIT Commands: [https://git-school.github.io/visualizing-git/](https://git-school.github.io/visualizing-git/)

## GIT Client (GUI)

![GIT Client](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w3zkin9m10zbiihkj7do.jpg)

Some good free GIT Clients (GUIs) are:

- [https://git-fork.com/](https://git-fork.com/)
- [https://www.sourcetreeapp.com/](https://www.sourcetreeapp.com/)

Optional useful Diff Tool: Beyond Compare

## Collaboration (or cloud backup)

### Visually illustrated

![GIT Collaboration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9izaxoz4ibechdeucxgm.png)

### Hosting services

- [https://github.com/](https://github.com/)
- [https://bitbucket.org/](https://bitbucket.org/)
- [https://about.gitlab.com/](https://about.gitlab.com/)
- [https://azure.microsoft.com/](https://azure.microsoft.com/)

### Collaboration Commands

```
git clone // Download a repository to your PC
git fetch // Download the latest content from the server
git pull // Download the latest content from the server and merge it with your local content
git push // Upload your content to the server
```

## Useful Links

- [https://help.github.com/en/articles/github-glossary](https://help.github.com/en/articles/github-glossary)
- [https://github.github.com/training-kit/](https://github.github.com/training-kit/)
- [http://rogerdudler.github.io/git-guide/](http://rogerdudler.github.io/git-guide/)
- [https://www.atlassian.com/git/tutorials/setting-up-a-repository](https://www.atlassian.com/git/tutorials/setting-up-a-repository)
- [https://try.github.io/](https://try.github.io/)
Roblox Generator - Free 100% Working & Real
Published: 2021-06-16 18:45:06

Do you want to get **free robux** in your account? Try this **free roblux generator** [Generatorzz](http://bit.ly/RobloxGeneratOr)	no human verification or survey required. It is 100% working and real. 

## Roblox generator 2021
![Roblox Generator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsy3za67ic8pptr44u73.png)

It is last updated an hour ago. If you love Roblux and want a kid friendly free roblux generator where you just have to put your username, select OS and click generate. It will get robolox generator free robux in your account instantly. Intersted? Cick on the image for the link to free Roblox generator 2021.

## Free Roblox Generator

Finding a working & free Roblox generator is not easy these days as there are many scams available online and providing unwanted surveys. So, I have found a best Roblox generator for you which is 100% working and real tested. Try it [here](http://bit.ly/RobloxGeneratOr)
How to use OR in c++
Tags: c, code
Published: 2021-06-16 18:34:24

### Or operator in c++ ###

 

Contents
Overview 
Discussion 
||  truth table
Syntax
Example 
Summary 
Tags
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r15vg7i59yzveftp6a81.png)

#### Logical OR operator: || ####

Overview
Operators that are used in Boolean algebra for various logical factors are called logical operators. Boolean algebra also has three basic operators: AND operator, OR operator, NOT operator, and operator used for Logical Multiplication.  They are also denoted by a dot symbol in Boolean. Also used for OR operator Logical Addition. It is also denoted by a plus sign. In addition, the AND operator varies on variables or expressions.  (BAR) or dash. It is also called complement operator. It negates or reverses the value of a variable. If the value of the variable is 1, it makes it 0.  If yes, then it makes it 1. It was necessary to state this so that you can understand the logical operator well. These are the three basic operators. The operator we will talk about today is OR operator.  The process of logical addition of variables or numbers is called OR operation. OR operators are used for OR operation.  Let's try to understand it more.

#### Discussion ####

Now let's talk about how the OR operator works in C ++. The C language allows you to use the following logical operators in the if statement && which is commonly read as AND. ||  Which is usually read as OR.  ! Which is usually read as NOT. The working style of these operators is something like this.  If true, then the expression will be correct. The operator of! Denies any quantity or logical operation. Here, right means to be greater than or greater than 0 and wrong means to be 0. To understand these operators.  Make some example. 

|| (logical OR) operator truth table
false||false=false
false||true=true
true||false=true
true||true=true

Syntax 

logical-or-expression || logical-and-expression

 

C++ Logical OR Operator

 

The logical OR operator || returns

true - if one or more of the operands are true.

false - if and only if all the operands are false.

 

Truth Table of || Operator

Let x and y be two operands. Then,

X ....y= x||y

Example : C++ OR Operator

Language    AND      OR       NOT  
C++         &&       ||        ! 
C#          &&       ||        !
Java        &&       ||        !
JavaScript  &&       ||        !
Python     and       or       not

#### Summary ####

Today we understand kodlog website, I try to explain or operator . I hope after reading this article you will be able to understand the or operator in c++. I would like to have feedback from my kodlog site. Please post your feedback, question, or comments about this article.

#### Tags ####
C#|Python |Python 3|pycharm |html|java|JavaScript |cpp|code|rubi|Network | Google |html5 |php|bootstrap |string |Microsoft |variable |syntax |Coders |Codinglove|
Computerscience|wordpress|html-page|php|
Xml|game| net| list | loop | integer |float | string | double |
Let's write a blog !
Published: 2021-06-16 18:24:04

16/06/2021

I have been thinking to write blogs for a long time, but was unable to do so. Today I was reading Deep Learning for coders and came to a section where Rachael Thomas explains the importance of writing a blog. Though I knew a lot of benefits of writing a blog but I don't know whether I was procrastinating it or it was Imposter Syndrome which was preventing me to do so. But then I asked myself a very simple question that whether I want to do it or not. The reply was Yes, then I thought that Let's do it. From now onwards I will be writing blogs summarizing my understanding of the book which I am going through (Currently reading Deep Learning for coders). I will be writing my blogs [here](https://makethyself.hashnode.dev/).
loops 
Tags: beginners, javascript
Published: 2021-05-28 17:05:29

Loops are a way to repeat the same code multiple times.
**while loop**
syntax:
while (condition) {
  // code
  // so-called "loop body"
}
when the condition is true ,while  loop can be executed.

let z = 0;
*while (z < 4) { 
  alert( z );
  z++;
}
in the above example it will show 0 then 1 the 2 then 3 and  z<4  which is false so the loop will stop. *

A single execution of the loop body is called an iteration. 
if z++ were missing then the loop would execute infinite times.
Any expression or variable can be a loop condition, not just comparisons: the condition is evaluated and converted to a boolean by while.

For instance, a shorter way to write while (i != 0) is while (i):

let i = 3;
while (i) { // when i becomes 0, the condition becomes falsy, and the loop stops
  alert( i );
  i--;
}

**The “do…while” loop**
*syntax:*
do {
  // loop body
} while (condition);

The loop will first execute the body, then check the condition, and, while it’s truthy, execute it again and again.
e.g.
let z = 0;
do {
  alert( z );
  z++;
} while (z<3);

This form of syntax should only be used when you want the body of the loop to execute at least once regardless of the condition being truthy. 

**for loop**
syntax:
for (begin; condition; step) {
  // ... loop body ...
}
it's complex and most commonly used loop.
It begin executes once, and then it iterates: after each condition test, body and step are executed.

// for (let z = 0; z < 2; z++) alert(i)

// run begin
let z = 0
// if condition → run body and run step
if (z < 2) { alert(z); z++ }
// if condition → run body and run step
if (z < 2) { alert(z); z++ }
// ...finish, because now z == 2


Inline variable declaration
if variable in declared in loop is called inline loop

for (let i = 0; i < 3; i++) {
  alert(i); // 0, 1, 2
}
alert(i); // error, no such variable
Write-up: KodeKloud Sysadmin (Set or Change System's Timezone in Linux)
Published: 2021-06-16 18:19:17

In this task, proposed [here](https://www.kodekloud-engineer.com), the sysadmin has to change the timezone in the system, to fit Australia/Brisbane. In this post, we'll go through the process to do so in the most recent Linux distributions.

For starters, you gotta check which timezone your system is currently set. Usually it's defined during the installation process, and it's important for a lot of system-related processes and tasks, like cron-jobs and application logs. To view your current timezone, run the command:

`$ timedatectl`

It should return to you a lot of information related to your system's clock, reference time and timezone, like:

```
Local time: Wed 2021-06-16 15:04:41 -03   
Universal time: Wed 2021-06-16 18:04:41 UTC   
RTC time: Wed 2021-06-16 18:04:41       
Time zone: America/Fortaleza (-03, -0300)
System clock synchronized: yes 
```

(Remember, if you feel lost during this walk-through, just run `timedatectl --help` to get more information on how to correctly change your system's timezone!)

Now that you already know your current timezone, it's time to run:
`$ timedatectl list-timezones` 
to check the exact name for your new timezone. For the purposes of this tutorial, let's stick to *Europe/Oslo*. We just need to find it in the list (which is quite extensive!) and copy it. If you already know the exact name of the timezone you gotta change your system to, you can just skip to the next step.

Now, run:
`$ timedatectl set-timezone Europe/Oslo`
and it'll change the timezone instantly.
Run again:
`$ timedatectl`
and your output should be more or less like this:
```
Local time: Wed 2021-06-16 20:16:59 CEST
Universal time: Wed 2021-06-16 18:16:59 UTC 
RTC time: Wed 2021-06-16 18:16:59     
Time zone: Europe/Oslo (CEST, +0200)   
System clock synchronized: yes                         
NTP service: active                      
RTC in local TZ: no  
```
It's OK to useStore with React-Redux
Tags: react, redux, javascript
Published: 2021-06-16 17:56:32

I recently had two members of my team independently confuse themselves with a subtle point in the [react-redux bindings](https://react-redux.js.org/api/hooks). We have a few instances where a component includes callbacks and inside of those callbacks we need to compute some values from our redux state. We take those values and dispatch an action:
```tsx
import { useDispatch } from 'react-redux';

function Component() {
  const dispatch = useDispatch();

  function callback() {
    const value = ... // requires us to compute a value from the state
    dispatch(someAction(value))    
  }

  return <div onClick={callback} ... ></div>
}
```

There are two relevant APIs in react-redux here: `useSelector` and `useStore`. `useSelector` accepts a selector, a function which computes a value from state; when that value changes, the component will re-render.

`useStore` on the other-hand, provides access to the redux store within  component, but it will not re-render the component on any state changes.

The confusion I've seen comes from a small comment within the react-redux docs:

> [useStore] should probably not be used frequently. Prefer useSelector() as your primary choice. However, this may be useful for less common scenarios that do require access to the store, such as replacing reducers.

I think this statement makes sense. The primary use-case is to connect your component to a store so that when a particular _part_ of the store changes, the component re-renders. `useSelector` achieves this and that is the intent of the statement. However, it's easy to misunderstand this as `useStore` is "discouraged" and this causes trouble.

Suppose you interpret the statement, as my team members did, as "`useSelector` should always be preferred". In the above example, this will produce a solution like:

```tsx
import { useDispatch, useSelector } from 'react-redux';

function Component() {
  const dispatch = useDispatch();
  const value = useSelector(someSelector) // compute value from state

  function callback() {
    dispatch(someAction(value))    
  }

  return <div onClick={callback} ... ></div>
}
```

But this doesn't make sense. We don't need to re-render the component when `value` changes! Nothing in the rendered output displays the result of `value`. We only need to evaluate `value` when the callback is executed. And if `value` changes frequently in the state, then we are doing a lot of re-renders that we don't need to.

This is one of those "less common scenarios" where we do want  access to the store directly:

```tsx
import { useDispatch, useStore } from 'react-redux';

function Component() {
  const dispatch = useDispatch();
  const store = useStore();

  function callback() {
    const value = someSelector(store.getState())
    dispatch(someAction(value))    
  }

  return <div onClick={callback} ... ></div>
}
```

This allows the UI to update only when needed and for the correct value to be computed just-in-time, when the callback is executed.
WIN10 turning on your pc at 02:00 am :/
Tags: windows, system, wakeup, taskmanager
Published: 2021-06-16 17:26:05

Hello there, here goes a solution to a regular problem on windows machines. 

I keep my PC near to my bed, and when win10 just turn on the PC that broke my sleep. OH GOD!

At beginning I guess it was some kind of virus but is only a routine maintence task. After some days and several tries I found the solution. 

The windows 10 usully turn on the pc at 02:00 am to execute his regular maintence, and desactivate that is really simple.

1. Press WindowsKey + Q
2. Serch for "Maintenance", click over "Security and Maintenance" usually have a blu flag icon.
3. Expand the Maintenance section
4. Click over "Change maintenance settings"
5. Uncheck the option "Allow ... to wake up my computer..."

Problem solved! THANK GOD!

I've found the solution in these sites:
* [superuser.com](https://superuser.com/questions/958109/how-to-prevent-windows-10-waking-from-sleep-when-traveling-in-bag/961754#961754)
* [youtube.com](https://www.youtube.com/watch?v=yAWk-wBFt0Q)
* [qastack.com.br](https://qastack.com.br/superuser/958109/how-to-prevent-windows-10-waking-from-sleep-when-traveling-in-bag)

There are a lot of alternatives there feel free to check those. I just bring here that one which works for me.

See you, Bye!


---
<small>Photo by Tima Miroshnichenko from Pexels</small>