teleren/devto huggingface dataset:
The Best Ruby on Rails Tutorials, Courses & Resources (2023 and Beyond)
Tags: rails, ruby, tutorial, programming
Published: 2022-07-27 14:52:00

_Last Update: 2022-01-13_

I'll keep this article always up to date, so come back from time to time.

**Rails Tutorials for Beginners**

- [**FREE App Academy Open**] (https://open.appacademy.io/learn/full-stack-online) by App Academy
- [**$$$ Ruby on Rails Tutorial**](https://www.learnenough.com/ruby-on-rails-7th-edition) by Michael Hartl
- [**$$$ Full Stack Rails**](https://learnetto.com/users/hrishio/courses/full-stack-rails) by Hrishi Mittal
- [**FREE Ruby on Rails**](https://www.theodinproject.com/paths/full-stack-ruby-on-rails/courses/ruby-on-rails) by The Odin Project

**Advanced Rails Tutorials**
- [**$$$ Rebuilding Rails**](https://rebuilding-rails.com/) by Noah Gibbs
- [**$$$ Sustainable Web Development
with Ruby on Rails**](https://sustainable-rails.com/) by David Bryant Copeland

**Rails Testing**
- [**$$$ The Complete Guide to Rails Testing**](https://www.codewithjason.com/complete-guide-to-rails-testing/) by Jason Swett

**Turbo & Hotwire**
- [**FREE Learn Hotwire by Building a Forum**](https://store.afomera.dev/learn-hotwire) by Andrea Fomera
- [**$$$ Hotwire for Rails Developers**](https://pragmaticstudio.com/courses/hotwire-rails) by The Pragmatic Studio
- [**FREE The Turbo Rails Tutorial**](https://www.hotrails.dev/turbo-rails) by Alexandre Ruban
- [**$$$ The Rebuilding turbo-rails Tutorial**](https://hotrails.podia.com/rebuilding-turbo-rails) by Alexandre Ruban
- [**$$$ The Rails and Hotwire Codex**](https://railsandhotwirecodex.com/) by Ayush Newatia

**JavaScript**
- [**$$$ UnPacked: A Single-Page App with Vue.js and Rails**](https://pragmaticstudio.com/courses/unpacked-single-page-app-with-vue-rails) by The Pragmatic Studio
- [**$$$ The Complete React on Rails Course**](https://learnetto.com/users/hrishio/courses/react-rails-course) by Hrishi Mittal

**Other Tutorials**
- [**$$$ Learn Enough Action Cable to be Dangerous**](https://www.learnenough.com/action-cable) by Michael Hartl
- [**$$$ Advanced CableReady**](https://julianrubisch.gumroad.com/l/acr/bf-2022) by Julian Rubisch

**DevOps**
- [**$$$ Docker for Beginners**](https://learnetto.com/users/jasonswett/courses/docker-for-beginners) by Jason Swett
- [**$$$ Dive Into Docker**](https://diveintodocker.com/) by Nick Janetakis

---

**YouTube Channels**
- [**Mix & Go**](https://www.youtube.com/c/Mixandgo)
- [**Deanin**](https://www.youtube.com/c/Deanin)
- [**GoRails**](https://www.youtube.com/c/GorailsTV)
- [**SupeRails by Yaroslav Shmarov**](https://www.youtube.com/c/SupeRails)

---

**Mentorship**
- [**FREE firstrubyfriend.org**](https://firstrubyfriend.org)
- [**$$$ MentorCruise**](https://mentorcruise.com/experts/rubyonrails)

---

**Podcasts**
- [**Remote Ruby**](https://remoteruby.com/)
- [**Ruby for All**](https://podcasts.apple.com/us/podcast/ruby-for-all/id1636775711)
- [**The Code with Jason Podcast**](https://www.codewithjason.com/podcast/)

---

_Did I miss anything important? Is any of the linked to resources above no longer available our outdated? Please let me know in the comments!_
Fastcode.Space - good opportunity for your business
Published: 2022-07-27 14:47:43

In the modern world business has moved into the virtual space. Websites help to promote the product and look for new customers. But creating websites from scratch is sometimes too difficult or even impossible. That is why it is better to seek the help of Fastcode.Space. On the service, users can choose a suitable website template. If you go to the official website ([https://fastcode.space/](https://fastcode.space/)), you can get acquainted with all the products of the service. The service helps to make the product more original, and helps to save a lot of time.

## What useful template services can be found on Fastcode.Space?

The main advantage of Fastcode.Space is the availability of tools to create a website that can be convenient and will bring benefits. The company offers:
• A wide selection of website templates which are optimally suited for various types of projects. Templates are suitable not only for large companies, but also for small ones that differ in a specific field of activity. The templates are also suitable for startups, because you don't need to invest so much money.
• Users can access backgrounds and test effects to properly design the service. Illustrations will help make the content more original, and will help attract new customers.
• In addition, customers can get HTML templates, as well as themes for CMS such as WordPress, Joomla, etc.
Customers can choose a suitable product for their site, but it will be more profitable to purchase a full subscription that opens access to all products.

## Choosing Fastcode subscriptions.Space.

Users can get unlimited digital access to Fastcode options and functions.Space. All you need to do is purchase a "Turbo Premium Space" subscription. When the subscription period ends, it will be renewed automatically. Plus, users will receive additional discounts and bonuses. One subscription gives access to all content. Content is not only templates, but also backgrounds, text effects, illustrations and much more.
It should be remembered that "Turbo Premium Space" is a license for one place, which means that only one individual can license, download and use content. The subscription fully covers all content, so users can use the features of the service without restrictions. Customers receive not only great business opportunities, but also real benefits.
If you want to start your own business and don't want to waste time creating a website, it's better to pay attention to Fastcode.Space. The site presents not only universal, but also specific templates for various purposes.
Environment Manager - Conda
Tags: setup, macos, windows, conda
Published: 2022-07-27 14:47:00

If you are testing programmes or developping your own I strongly suggest to look after an environment manager. An easy way to install libraries into dedicated environments in isolation from each other, and to keep track of what is installed where. A whildely used environment manager is [conda](https://docs.conda.io/en/latest/index.html)

## Install on Windows
> Before reading this post, I suggest you follow [Ubuntu on Windows (WSL)](https://dev.to/mhebrard/ubuntu-on-windows-wsl-40po).

- Open 'Ubuntu'
- Download Miniconda installer for Linux

```
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
```

- Install miniconda

```
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
```

- Press `Enter` to continue
- Press `Space` to read through the licence
- Key 'yes' to accept the licence
- Press `Enter` to install miniconda3
- Key 'yes' to confirm installation
- Quit and restart 'Ubuntu'

At this point you will find a new information in your prompt that indicate in which conda environment you are currently in.

![Win base](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tp0ih5cae9rlco1y2ric.png) 

## Install on MacOS

> Before reading this post, I suggest you follow [Improved Shell (MacOS)](https://dev.to/mhebrard/improved-shell-macos-3kme).

- Open 'Terminal'
- Install miniconda from Homebrew

```
brew install --cask miniconda
```

- Configure conda for zsh

```
/opt/homebrew/bin/conda init zsh
```

- Quit and restart 'Terminal'

At this point you will find a new information in your prompt that indicate in which conda environment you are currently in.

![macOS base](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vevyf3sotdly58kcebij.png)

## Usage

- Update conda

```
conda update -n base -c defaults conda
```

- Create a new environment

```
conda create -n myEnvName
```

- Activate the environment

```
conda activate myEnvName
```

- Install libraries
You can find libraries and how to install them either on [Anaconda](https://anaconda.org/) or [pip](https://pypi.org/project/pip/)

```
conda install ...
```
```
pip install ...
```

- List all libraries in the current environment

```
conda list
```

- Exit an environment

```
conda deactivate
```

- Remove an environment

```
conda env remove -n myEnvName
```

- List the environements available

```
conda env list
```

> Next, I suggest you follow [Cross Platform, Cross Language Text Editor - VSCode](https://dev.to/mhebrard/cross-platform-cross-language-text-editor-vscode-3g2k).
Replace String part on Swift
Tags: swift, programming, ios, mobile
Published: 2022-07-27 14:36:40

HI all,
some years ago i needed to substitute "," with "." in a String.

I used this func :
`extension String {
    mutating func replace(_ originalString:String, with newString:String) {
        self = self.replacingOccurrences(of: originalString, with: newString)
    }
}`

but today I discovered Swift has a Method [replacingOccurrences](https://developer.apple.com/documentation/foundation/nsstring/1412937-replacingoccurrences) in a String 🥳🥳
Let's build a simple breadcrumbs component with Tailwind CSS
Tags: tailwindcss, css, webdev, beginners
Published: 2022-07-27 14:33:02

Here is an example of creating a simple breadcrumb component with Tailwind CSS.

Add initial HTML.

```html
<nav aria-label="Breadcrumb">
    <ul>
        <li><a href="/">Home</a></li>
        <li><span aria-current="page">Category</span></li>
    </ul>
</nav>
```

Add three lines of CSS code.

```html
<nav aria-label="Breadcrumb">
  <ul className="flex">
    <li className="after:content-['/'] after:px-2">
      <a href="/" className="underline">
        Home
      </a>
    </li>
    <li>
      <span aria-current="page">Category</span>
    </li>
  </ul>
</nav>
```

And you got yourself some breadcrumbs!

![Breadcrumbs with Tailwind CSS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r8gjbyswdnzrs5m639la.png)
AWS GuardDuty - Now Packing Malware protections
Tags: aws, security, devops, cloud
Published: 2022-07-27 14:22:00

**What is it?**
This additional feature/functionality within GuardDuty detects those malicious files which may be hiding within EC2 instances or container workloads for example. 

**How does it work?**
By scanning files stored in AWS EBS volumes, GuardDuty is able to detect malware that may be used to harm your AWS resources or gain access to your data. 
If you are an existing AWS customer, you can enable the GuardDuty Malware Protection feature in the GuardDuty console. When Malware/threats are detected, GuardDuty Malware Protection will send those findings to other AWS Security Services such as AWS Security Hub, Amazon EventBridge, and Amazon Detective. These integrations help consolidate the monitoring, and automation of the malware findings. 
Amazon GuardDuty Malware Protection has eight new threat detections:
Execution:EC2/MaliciousFile Execution:ECS/MaliciousFile Execution:Kubernetes/MaliciousFile Execution:Container/MaliciousFile Execution:EC2/SuspiciousFile Execution:ECS/SuspiciousFile Execution:Kubernetes/SuspiciousFile Execution:Container/SuspiciousFile

More info is available [here](https://docs.aws.amazon.com/guardduty/latest/ug/malware-protection.html)
Different ways to log messages in Nodejs
Tags: node, javascript
Published: 2022-07-27 14:08:00

How many ways do you know ?
According to my little research, there are 3 different ways you can log messages in 𝗡𝗼𝗱𝗲𝗷𝘀.

1- 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗹𝗼𝗴: We all know this one and have used it extensively in Javascript. What people don't know that under the hood it actually uses 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲 with a line break.

2- 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲: Unlike the previous one, this outputs messages on the same line; so you're going to need to manually add like breaks.

3- 𝗳𝘀.𝘄𝗿𝗶𝘁𝗲𝗦𝘆𝗻𝗰: Also requires manual line breaks. Writes to 𝗽𝗿𝗼𝗰𝗲𝘀𝘀.𝘀𝘁𝗱𝗼𝘂𝘁.𝘄𝗿𝗶𝘁𝗲 like 𝗰𝗼𝗻𝘀𝗼𝗹𝗲.𝗹𝗼𝗴. This method though is a little unique. It takes an integer as the first argument, something called a 𝗳𝗶𝗹𝗲 𝗱𝗲𝗰𝗿𝘆𝗽𝘁𝗼𝗿. To make it write to the 𝘀𝘁𝗱𝗼𝘂𝘁, you have to set it to 1. I'll talk about it in my next post.

Did you learn something new today?

Like and share this post, and follow me for more!


![logging messages in nodejs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jg8lffg0pucfecbyzsd3.png)
Scaling a DNS server?
Tags: discuss, dns, nameservers
Published: 2022-07-27 14:06:00

Hello!

I was just wondering:
How to scale a DNS server.
Of course, you could add more servers, but it's very illogical to have hundreds of nameservers for a domain.

Or by adding a load balancer, but then I won't see the client IP. (for geo based routing)
So what's a good way?
How to fix "SyntaxError: Unexpected token < in JSON at position 0" and "Unexpected end of JSON input"
Tags: javascript
Published: 2022-07-27 14:04:55

If you are coding in JavaScript, React, or any other JavaScript library/framework, you would have come across the following errors:

`SyntaxError: Unexpected token < in JSON at position 0`

`SyntaxError: Unexpected end of JSON input`

## When does this error occur?

This error occurs when you are trying to parse a string to JSON and the string is not parsable. In other words, it happens when you pass an invalid JSON string to [JSON.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) function.

Try executing the following code in the browser console:

```js
JSON.parse("<html>")
```

You will see the following error:

![json parse error 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yr36a72ehtrwbebdmnb2.png) 

So the error is telling that it is seeing a string `<` at the beginning since a valid JSON should start with `{`.

Now if you execute the following code, you will get the second error:

```js
JSON.parse('{"html')
```

![json parse error 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6b2nlofij8ydwabm82cc.png) 

If you observe the JSON string, it starts as a valid JSON, however, the JSON is not complete. Hence it is telling 'unexpected end of JSON input'.

Let's now see how we can reproduce same issue in React application:

```jsx
import { useEffect } from "react"

function App() {
  useEffect(() => {
    const fetchData = async () => {
      const response = await fetch("https://jsonplaceholder.typicode.com/")
      const data = await response.json()
      console.log({ data })
    }

    fetchData()
  }, [])
  return <div className="App">home</div>
}

export default App
```

The above code attempts to fetch the data from `https://jsonplaceholder.typicode.com/` and calls `response.json()`. When we call `response.json()`, it internally calls `JSON.parse()` to convert the response into a JSON Object.

However, the URL we have passed is of an HTML page and we will be getting an HTML string as the response. Hence, if you execute the above code, it will throw the error: `SyntaxError: Unexpected token < in JSON at position 0`.

## How to fix this issue?

We can fix this issue by making sure that we are calling the right endpoint and we are getting a valid JSON response.

We can do so by opening the URL in the browser and checking the `content-type` response header:

### HTML content type

![html content type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zhe6ie0pmvfbw5qjou1w.png) 

### JSON content type

If you check the `content-type` of an endpoint that returns a valid JSON, like [https://jsonplaceholder.typicode.com/posts](https://jsonplaceholder.typicode.com/posts), you will see the `content-type` as `application/json`.

![json content type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ums7fyp9hyrw90ie485n.png) 

You could also validate if a string is a valid JSON or not in tools like [JSON Formatter](https://jsonformatter.org/json-parser).
Firebase Auth with Supabase
Tags: firebase, supabase, flutter, dart
Published: 2022-07-27 14:00:00

This is a quick guide to using Supabase's Row Level Security with **Firebase Auth on Flutter** without having to write any additional middleware.

Supabase officially supports many authentication providers, including SuperTokens, AuthO, and others. However, there is currently nothing for Firebase, but to be fair, I'm not sure of many use cases like this, so perhaps that's why it doesn't exist...

I was stuck for a few days trying to figure this out.  So it seems only fair to share what I've come up with as a solution for others to find - especially since I noticed a couple of questions.

##Step 1: Create a table in Supabase

Assuming that you already have a project in Supabase, create a _users_ table and enable RLS in the process using the code below.

```
CREATE TABLE users (
    user_id VARCHAR(250) PRIMARY KEY,
    email VARCHAR(250) NOT NULL
);

ALTER TABLE users ENABLE ROW POLICY;
```

##Step 2: Create a validator function
You can use any of the keys in the JWT payload to verify a user, but for this guide, I'll use the "email verified" key. The following is the code:

```
CREATE OR REPLACE FUNCTION email_verified() 
RETURNS boolean LANGUAGE sql stable AS
$$
SELECT NULLIF(
current_setting('request.jwt.claims', true)::json ->> 'email_verified', 'false'
)::boolean;
$$;
```

##Step 3: Enable RLS policies

Using the policy creation dialog here's the code to use for the CHECK expression.

_NB: For INSERT queries it's important that you also have a SELECT policy in place. Otherwise your requests will fail_

```
email_verified() = true
```

![INSERT policy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n3rslnrcj2cvx4iz57e5.png)


##Step 4: Override the default JWT

###Create a supabase JWT
To do this you will need the:

- The Firebase JWT,
- Your Supabase JWT secret,
- The [dart_jsonwebtoken](https://pub.dev/packages/dart_jsonwebtoken) library and
- [jwt_decoder](https://pub.dev/packages/jwt_decoder) library

Below is the code for creating a supabase token
```
accessToken() async 
{
  // GET JWT from Firebase
  String firebaseToken = await FirebaseAuth.instance.currentUser!.getIdToken();
  // Decode JWT to extract payload
  Map payload = JwtDecoder.decode(firebaseToken);

  return JWT(payload).sign(SecretKey("[SUPABASE JWT SECRET]"));
}
```

###Call setAuth from the Supabase client

```
Supabase.instance.client.auth.setAuth(accessToken());
```

That’s all! 

You have now successfully connected FirebaseAuth to Supabase whilst keeping things secure.

There are certain things that I do not cover in here for the purposes of brevity. Things such as:

- Synchronising users between the two systems
- Verifying user emails in FirebaseAuth

But these and probably more are important to think about when using this approach.

🚀
React JS - Clase 2
Published: 2022-07-27 13:39:00

Hola a todas y todos. He creado este foro en dev.to para atender las consultas que puedan surgir respecto al curso que dicto actualmente. Debido a que es un foro público, por favor no compartan información sensible como datos personales, etc. Pueden dejarme sus comentarios debajo de esta publicación y con gusto les estaré respondiendo a la brevedad. 

Elegí dev.to ya que más allá de ser gratuito, también podrán acceder a muchos post de la comunidad de desarrolladores, además podrán escribir código acá o adjuntar imágenes para realizar sus consultas. 

Cualquier sugerencia que tengan es bienvenida 😊

Les dejo el componente que creamos hoy:

## Count.jsx

```javascript
import React, { useState } from 'react';
import './styles/Count.css'

const Count = ({ initial, stock }) => {

    const [ count, setCount ] = useState(initial);

    const addCount = (num) => {
        console.log('Se ejecuta addCount');
        setCount(count + num);
    }

    return(
        <div className="count-container">

            <div className="count-container__count">{count}</div>

            <div className="count-container__controls">
                <button 
                    disabled={count===initial}
                    className="controls__button"
                    onClick={()=>{addCount(-1)}}               
                >
                    -
                </button>
                <button
                    disabled={count===stock} 
                    className="controls__button"
                    onClick={()=>{addCount(1)}}
                >
                    +
                </button>
            </div>

        </div>
    )
}

export default Count;
```

## Count.css

```css
.count-container{

    width: 100%;
    min-height: 400px;
    text-align: center;

}

.count-container .count-container__count {
    font-size: 8rem;
}

.count-container .count-container__controls {
    
}

.count-container .count-container__controls .controls__button{
    font-size:4rem;
    padding:9px 12px;
    cursor: pointer;
}
```

Si bien les dije que vamos a crear un repositorio de github, se me ocurrió que podemos ver cómo subir nuestro repo en github para la siguiente clase, así que lo haremos la próxima semana. 


Acá les dejor un ejemplo que hice para el contador de un e-Commerce

{% embed https://stackblitz.com/edit/react-zsrflx?embed=1&file=src/components/ItemCount.jsx %}
WordPress Plugin Boilerplate Powered 3.3.0
Tags: plugin, wordpress
Published: 2022-09-05 08:43:56

---
title: WordPress Plugin Boilerplate Powered 3.3.0
published: true
date: 2022-07-27 13:34:43 UTC
tags: plugin,Wordpress
canonical_url: https://daniele.tech/2022/07/wordpress-plugin-boilerplate-powered-3-3-0/
---

A new major after 2 years for my WordPress plugin boilerplate with code generator...

The post [WordPress Plugin Boilerplate Powered 3.3.0](https://daniele.tech/2022/07/wordpress-plugin-boilerplate-powered-3-3-0/) appeared first on [Daniele Mte90 Scasciafratte](https://daniele.tech/eng).
What was your favorite project?
Tags: discuss, anonymous
Published: 2022-07-27 13:30:17

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***

Hey DEV. I feel like there's a lot of negativity in the world, and I could do with a mood boost. Could you please share with me some of everyone's favorite projects they've worked on? Maybe that'll motivate me to start some new projects of my own.
First usage golang benchmarks in Ubuntu WSL
Published: 2022-07-27 13:22:38

Hi there! 

Some days ago I first time faces with benchmarks in go and did hands-on for my class. If you use Windows + WSL Ubuntu for Golang, my experience would be useful for you.

I faced couple of problems with components, lets talk about

## No Graphvis for pprof
I made my first profile
```
$ go test -bench=BenchmarkGetDomainStat -cpuprofile=cpu -memprofile=mem
$ go tool pprof -http="localhost:8080" cpu

Serving web UI on http://localhost:8080
Failed to execute dot. Is Graphviz installed?
exec: "dot": executable file not found in $PATH

```

There is no Graphviz. Google it up, we have to install graphviz:
```
$ sudo apt install graphviz gv
```
If you get some fails like I:

```
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/ghostscript/ghostscript-x_9.26~dfsg+0-0ubuntu0.18.04.15_amd64.deb  404  Not Found [IP: 91.189.91.38 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
```

just update and repeat:
```
$ sudo apt-get update
$ sudo apt install graphviz gv
```

Whoa! You have your graphviz and pprof ready to show you cool graphs.

## No benchstat
I installed Go 1.17.1 and forget about anything. But in case of benchmarks i want to compare two results:
```
$ benchstat benchmarks/00 benchmarks/01
benchstat: command not found
```
WTF? there is no benchstat installed by default, lets fix it:
```
$ go get golang.org/x/perf/cmd/benchstat
go: downloading golang.org/x/perf v0.0.0-20220722155240-3d85ee92886d
go get: added golang.org/x/perf v0.0.0-20220722155240-3d85ee92886d
```
also go get informs me about deprecating and offers to use 'go install'. Good idea for trying next time

Now lets check result:
```
$ benchstat benchmarks/00 benchmarks/01
name             old time/op  new time/op  delta
GetDomainStat-8   1.15s ±75%   0.36s ±11%  -69.05%  (p=0.000 n=10+10)
```
Cool, benchstat is avaible and my optimizations work well



I hope my googling is helpful and will save few minutes for you, my dear Windows WSL gophers!