teleren/devto huggingface dataset:
"weak"ly linked #2
Tags: ios, mobile, swift
Published: 2021-11-28 19:08:32

####1. Customizing `Codable` behaviour via `@propertyWrapper` 🛠
{% twitter 1415131799584313345 %}

This addition to `Codable` flew under my radar since I was more into exploring the [new support for enums with associated values](https://github.com/apple/swift-evolution/blob/main/proposals/0295-codable-synthesis-for-enums-with-associated-values.md). This custom configuration support also look very interesting. I need to take this for a spin to see its power in reality. 

####2. Multiple protocol conformances by the same type?

{% twitter 1462815005724885004 %}

A super interesting thread by [Jordan Rose](https://twitter.com/UINT_MIN) and a nice commentary from [Max Desiatov](https://twitter.com/maxdesiatov) with interesting real life example from [Tokamak UI](https://twitter.com/TokamakUI). Who knew, that creating a programming language was hard? 😅

####3. `UITableView` inside `UITextView` :sweat_smile:
{% twitter 1462927547776311301 %}

This addition to iOS 15 gives you the possibility to create a `UITableView` inside `UITextView` :sweat_smile: While itself not the best idea probably, the general possibility of embedding custom `UIView`s inside text sounds interesting.
Here are the [official docs](https://developer.apple.com/documentation/uikit/nstextattachmentviewprovider?changes=_2_8_6_1) for the feature.

####4. API Client using actors 🎭
https://kean.blog/post/new-api-client

A super comprehensive post - or should I say tutorial/guide - on creating an API client for your Swift app that leverages the new actor system. This guide has everything - starting with basic requests through authentication and ending in SSL Pinning and caching. The "tools" 🛠 section is also interesting!

####5. SwiftUI Navigation
https://www.pointfree.co/blog/posts/66-open-sourcing-swiftui-navigation

Folks behind Point Free don't need any special introductions - being the authors of [Swift Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture). Now they give us a robust way to enhance navigation patterns in SwiftUI - now to find a project to use this on!

------
<sup>
What this is:
A subjective list of links I found interesting during last week, mainly to keep them around.
</sup>
Speed up your development with Git aliases 🚀
Tags: git, javascript, productivity, webdev
Published: 2021-11-28 19:02:34

Git aliases are a powerful workflow tool that creates shortcuts to frequently used Git commands. Using Git aliases will make you a faster and more efficient developer.

## Creating aliases

Use the command below to create aliases, replacing `<alias>` with the name of the alias and `<command>` with the command to be aliased:

![command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fe18yrdgfo35yo9094bw.png)

Alternatively, you can edit the global git configuration file and add all aliases at once, by opening the git configuration file by running `git config --global -e` in your terminal.

### Useful aliases

![.gitconfig](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a091r6ic6d5tu0t0ax7a.png)

I'm [@bjakyt](https://twitter.com/bjakyt) on Twitter. Follow me for more!
How to create cover images in dev.to with the title and author's name?
Tags: discuss, beginners, devjournal, 100daysofcode
Published: 2021-11-28 18:58:07

I've been seeing articles here in dev.to with the banner/cover image showing the article's title, the publish date, and the author's name, plus the DEV logo a the right side, similar to the one below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1i5hykbgacsjsilr6la4.png)

More examples:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l0mmgvl0vyfl7ccqva9l.png)
 
I followed the instruction on this [link](https://dev.to/dev3l/comment/i87) but I'm having no luck in creating the "auto-generated banner from the article's title". 

I did find this link about how "automated images" are created but I was wondering if there's other options that other people here dev.to is using?
GitHub Command Palette
Published: 2021-11-28 18:43:22

{% youtube FBJeqQKRjsI %}
GitHub has introduced a number of amazing features this year (2021) and personally I love them all (codespaces, copilot etc). 
One of them is Command Palette. Which makes it really easy to navigate and change settings anywhere on GitHub.

![GitHub Command Palette](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgmy42fnvbpxy0gl9ltr.png)
 

You can do things like toggling between **Dark/Light** mode, creating new repositories, issues, pull requests etc without navigation between pages.

## Opening Command Palette
You can open command pallete using one of the following keyboard shortcut:

Windows and Linux: `Ctrl + k` or `Ctrl + alt + k`
Mac: `⌘ + k` or `⌘ + option + k`
When you open the command palette, it shows your current location at the top left, for example:

![Current Repository](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k0lkmecx7rykecrpy9hk.png)
 

### Prefixes

The command palette has different prefixes.
- `#` for pull requests and issues
- `>` for commands
- `?` for help

[More prefixes](https://docs.github.com/en/get-started/using-github/github-command-palette#keystroke-functions)

Let's try something with command palette.

## Toggling modes from Command Palette
Toggling modes from command palette is pretty simple and super quick. All you need to do is to simply open it and type `> theme` and it will list down the available options.

![Switch to dark Theme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndzs3fbqx3zyjcbs56ug.gif)


For more details, visit [GitHub Command Palette](https://docs.github.com/en/get-started/using-github/github-command-palette).
My journey to learn Smart Contract
Tags: todayilearned, blockchain
Published: 2021-11-28 18:37:07

This blog is to gather all the tutorials I tried as part of my learning journey.

**Hello World Smart Contract by Alchemy**
https://docs.alchemy.com/alchemy/tutorials/hello-world-smart-contract

After I read about Ethereum and Smart contract from a few books (and fall asleep many times) It is time to start learning by doing.

This tutorial helps you to understand how to deploy a smart contract to a test network and how to connect it with the frontend via [Web3](https://web3js.readthedocs.io/en/v1.2.9/) *- a collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.*

Alchemy is a platform that lets developers build applications on top of blockchains such as Ethereum. You can think about it as AWS for blockchain ([More information about the company here](https://techcrunch.com/2021/10/28/aws-for-blockchain-alchemy-boost-valuation-to-3-5b-with-250m-raise/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAAENURnixJBNC6rBP6vgAe7emu73CEGAjQhlUU09PfJWxQTsvYUxUsQHSxB99BGpZodGX-XK_wWL5NI4nrjlmJBGLi6LSA7nIMRiqigRJakOmzsLvZMcbbeFWDDiAy3WB8doZ8liQ5cE4VWrD5MlbS3UOJ7KFfg-8ZKj9DOccnDdj))

For anyone who is interested in signing up. Please feel free to sign up [here](https://alchemy.com/?r=39d9fef308b9a64f)


**Solidity By Example**
https://solidity-by-example.org/
<< My next plan to learn from the example - will update what I learn soon. >>
SPO600 Week 8 reflection
Published: 2021-11-24 05:07:40

Hello my friends, welcome to the week 8 of SPO600(Software Portability and Optimization) blog. In  this blog, let’s talk about the registers in the x86_64 framework. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcs9pu23z0um1u9ulxuz.png)
 
#Instruction#
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebqq9j7mszr21utkfbf7.png)
Remember that the x86_64 processor family is based on a long long series of processors that date back to the 1970s. So originally on these processors we had a small number of registers, like the X and Y register of the [6502 assembly language](http://6502.org/tutorials/6502opcodes.html) on the x86 family. The mean registers in x86_64 are A, B, C, D registers. Through the years, the register family has been extended, we still have the A, B, C, D registers but now they are called RAX, RBX, RCX, RDX which mean the extended registers of A, B, C, D and they are 64-bits wide. Beyond this, we also get RBP which means the register base pointer to store the start of the stack, and then we get RSP which stores the stack pointer, RSI and RDI are typically used for copy operation. RSI stores the source index which is pointing to the source that you want to copy and the RDI stores the destination index where you want to place the copy to.  X64 also added another 8 (R8-R15) registers. Since some of x86’s registers have special implicit meanings and are not used as general-purpose. 

#Passing Argument#
In this blog, I only focus on integer arguments. For example, 7 integer arguments to a function are passed in registers. The first integer is placed in RDI, the second integer is placed in RSI, the third integer is placed in RDX, the fourth integer is placed in RCX, and then R8 and R9. only the 7th integer is passed on the stack.

#Reflection#
This is the second week that we step on X86_64 and the AArch64 framework. In this blog we only discuss the registers in x86_64 but in the future I will also blog more about the AArch64 framework. This week I learned that modern processors are super fast because they often "guess" the outcome of an operation and store the results of "guess" into the registers that we talked about above.
EC2 Userdata script: Changing EC2 instance default username + run commands 
Tags: aws, devops, devjournal, linux
Published: 2021-11-28 18:31:55

This is a short note on how to change the username that your EC2 instance uses upon startup. If you're using RHEL or CentOS, you probably see that the default username you see when you log in to your instance for the first time is **ec2-user**.

You can change this, plus run other commands during startup by using the script below and putting it on the **User Data** field during the creation of instance.

In this example, I'm setting the following:
- default username: jeden
- hostname: tst-rhel
- format of the shell prompt

```bash
#cloud-config
system_info:
  default_user:
    name: eden

runcmd:
 - 'sudo hostnamectl set-hostname tstrhel'
 - 'sudo sed -i "s/localhost/localhost tstrhel/" /etc/hosts'
 - 'echo "PS1=\"[\u@\H: \W] $ \"" >> .bashrc'
 - 'sudo yum update -y'
 - 'sudo yum install -y vim nano wget bash-completion firewalld'
 - 'sudo yum install -y epel-release'
 - 'sudo yum install -y python3'
 - 'sudo yum install -y python3-pip python-devel'
 - 'sudo yum groupinstall -y "development tools"'
 - 'sudo pip install --upgrade pip'
 - 'sudo yum install -y policycoreutils-python-utils'
```

You may add more commands to be ran during startup by appending them in the **runcmd** section.

#### Note:
Some commands may not be ran during startup especially if the command requires that bootup process is done before it is executed.
Authentication: Cookie- vs. Token-based
Tags: webdev, authentication, javascript
Published: 2021-11-28 18:27:41

Authentication is about confirming that users are who they say they are. Whereas authorization is about permissions of a given user (e.g. admin vs. user). Authentication is an integral part of most apps.

The two main methods for authentication are cookies and tokens. But what are the differences between the cookie- and the token-based approaches?

## Cookie-based Authentication

The cookie-based approach is also often referred to as **session authentication**. When using session authentication, a cookie with the session id is created on the server and is sent to the client. The browser automatically stores the cookie and sends it alongside every subsequent request to the server. The server then looks up the session id and verifies its validity. The client doesn't have to deal with storing session-related information at all.

**Sidenote:** Dealing with sessions by using a cookie is not the same as a **session cookie**. A session cookie is a cookie without the `Max-Age` or `Expires` attribute being set. Therefore a session cookie gets deleted when a user closes the browser window or tab (= a user is ending the session). The term session cookie provides no information about what content a cookie stores.
 
## Token-based Authentication

Tokens use a different approach. The token containing the session information is created on the server. It is encoded and signed by the server and sent to the client. The client can use the session information in that token. In this case, the client has to store the token (usually in `localStorage` or `sessionStorage`) and has to actively send the token along with every request (usually in the `Authorization` header). The server doesn't have to keep track of the sessions. The token contains all information the server needs to verify the session. (**EDIT:** Except the secret key, which is used for signing.) The signing of the token prevents the client from manipulating it.

The most popular way of using tokens for authentication is JSON web tokens (JWTs). You can learn more about JWTs specifically at [jwt.io](https://jwt.io/introduction).

## Summary

The main difference between the cookie and token-based approach is where the session information is stored. In the cookie-based approach, the burden of storing the session is on the server-side in contrast to the token-based approach where the client is responsible for storing the session information.

![authentication.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1636403503161/8wg6Rz35A.png)
Como bypassar o reCAPTCHA v3 do Google
Tags: nike, bypass, recaptcha, bot
Published: 2021-11-28 18:26:13

## Motivo
Uma vez peguei um freela para fazer, pois já era a terceira vez que alguém me pedia para fazer um bot para o site da nike, porém, antes de aceitar eu queria ver se realmente era possível automatizar a compra.

## Ferramentas que usei para analisar
* [charles proxy](https://www.charlesproxy.com/)
* Python(import requests)
* [trillworks curl2python](https://curl.trillworks.com/)

## Como Google reCaptcha funciona?
Após alguns testes, cheguei as seguintes conclusões:
* Ao abrir um site, o google avalia a confiabilidade da conta logada, você pode checar a sua pontuação nesse [site](https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php)
* Uma nova conta ou em modo anônimo recebe uma pontuação de 9, porém, com o tempo essa pontuação pode cair para 7 e mesmo a api retornando os tokens, a Nike não aceitara uma pontuação abaixo de 9.
* Não sofri nenhum tipo de limitação de requisição porém não é bom abusar 😉


## Sobre a Nike

* os lançamentos da nike são liberados sempre no mesmo horário 10h
* Para realizar a compra de um produto, devemos antes adiciona-lo no carrinho.
* Para adicionar alguns snkrs no carrinho é necessário passar por um two-facture
* É feito um POST para ```https://www.nike.com.br/auth/two-factor/validate```
nesse POST passamos no parâmetro data
```
data = 'NumberCode='+RecaptchCode+'&ProdutoId='+IdProduto
```
* (!importante) - A nike somente checa se a pontuação do token retornado pela api do google é aceitavel >= 9,
ou seja, podemos ter uma uma conta(um email) com uma pontuação boa, gerando inúmeros tokens para usar outras contas(outros emails) cadastrados no site da Nike.

## Resultado
Por fim, acabei criando um script usando o tampermonkey que automatiza isso caso eu precise em projetos futuros.

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

[script para download](https://pastebin.com/3MCrm4MY)
obs. está configurado para abrir somente no url https://www.nike.com.br/atendimento
PHP - Deprecation of Dynamic Properties
Tags: php, webdev, programming
Published: 2021-11-28 18:12:12

Recently the Deprecate dynamic properties RFC has been approved for PHP 8.2, which means that dynamic properties will not be allowed in PHP 9.0.

here's an example of declaring dynamic property:


```php
class User {
    public $name;
}
 
$user = new User;
 
// Assigns declared property User::$name.
$user->name = "foo";
 
// Oops, a typo:
$user->nane = "foo";
// PHP <= 8.1: Silently creates dynamic $user->nane property.
// PHP    8.2: Raises deprecation warning, still creates dynamic property.
// PHP    9.0: Throws Error exception.
```
*code snippet from https://wiki.php.net/rfc/deprecate_dynamic_properties*

Judging by the pace of PHP development, version 8.2 will be released in November 2022, and version 9.0 in November 2025 so we have plenty of time to prepare for this change.


In my opinion, this is a good change, it makes PHP more strict language and it will prevent mistakes and hard to find bugs.

And what do you think about this change?
I'm building something - Ep.2
Tags: webdev, beginners, rails, codenewbie
Published: 2021-11-28 18:01:55

I got busy right after the first post and now I have a functional prototype. This is what you see when you visit the "homepage" index:

![Categories - Index](https://www.webmuffins.com/content/images/2021/11/image.png)

I know, it looks like crap. But hey, I didn't say it was going to be pretty 😜

The beauty of Rails, and its scaffolding generator, is that with just a few lines of code, you can have a fully functional -not pretty- but fully functional web application, that does all you need it to: CRUD! Create, Read, Update, and Destroy.

Right now, if I want to add or view my listings, I have to go to a listing index that looks like this (by default, again, thanks to the scaffold generator).

![Listings - Index](https://www.webmuffins.com/content/images/2021/11/image-1.png)

This is a list of all listings and their attributes. The category attribute reflects the category ID, not the category title or name, so that has to be changed so it's more descriptive.

So, a few things to fix:

1. Clicking each category will show its contents, i.e. the listings it contains.
2. When creating a listing and adding it to a Category, the category selection should be the ´category.title´ not the ´category.id´
3. Eliminate the unnecessary scaffold code. This includes things like unnecessary CRUD actions, unnecessary views, etc.

I played a bit with Whimsical (which has amazing UI/UX, by the way) and came up with this:

![Whimsical mockup](https://www.webmuffins.com/content/images/2021/11/image-5.png)

I'm not sure if the site will end up looking like that, but it's a start.

In the next post I'll tackle the punch list I wrote above and try my hand at coding some custom css to make it a bit more appealing.

This was originally posted on my blog: [WebMuffins.com](www.webmuffins.com)
🙅 Never copy/paste when you’re learning React (or any other library/language)
Tags: react, webdev, productivity, beginners
Published: 2021-11-28 17:48:43

Learning a new language or library and **thinking about copying and pasting** that Stack Overflow chunk of code, tutorial example, or "Getting Started" code block?

**Think again!**

_Why not?  Let's examine..._


## The Benefits of "typing it out"

Taking the extra time to type something out rather than copying and pasting it gives you several advantages:

### 🧠 Memory
The learning period is the most important phase to take the extra time to ensure you're getting in actual practice.

Take a breath, take it slow, and you will be thankful that you actually remember the syntax later. (... and don't worry, your code typing speed will become much faster! 🚀)

### 🧑‍💻 Interviews
`Ctrl+C, Ctrl+P` can be a good tool for speed in some cases, but it won't help much when you're expected to quickly code for yourself in a fast-paced, high pressure situation. 

Would you copy/paste or type-out the following basics?
``` 
npm install --save-dev @testing-library/react
// It's beneficial to know terminal basics 
// like npm, git, etc
```
```
test('loads and displays greeting', () => {
  render(<Fetch url="/greeting" />)
  expect(screen.getByText('Load Greeting')).toBeInTheDocument()
})
// Without looking, can you write a complete test spec 
// file from scratch?
```
```
import React, { useState } from 'react';
import IconButton from '@mui/material/IconButton';
import SplitRow from 'components/layout/SplitRow';
// Manually typing imports helps understand and remember
// libraries and project structure
```

### ♻️ Refactoring/Reuse
Sometimes the ease of copy/paste prevents us from realizing what should be refactored into its own method or component.

You'll quickly become annoyed by typing repetitive code and start enjoying creating re-usable blocks as you code rather than coming back to it later.

### ✅ Code Quality
When you're writing a new file/code block, it's tempting to copy/paste similar code from somewhere else in your project and make small adjustments.  

However, hastily copy/paste/adjusting may leave you with a "hack" or other issues like sub-optimal naming conventions. Additionally, you may have already learned a better way to accomplish the task than in your previous code.  

**_I hope you'll enjoy copying/pasting less and coding more!_**

*P.S. Sometime's screen real estate is an issue, so I use a learning hack of copying and pasting into my file, typing out the same code above the pasted block, then deleting the pasted code*
Google Summer of Code 2022
Published: 2021-11-28 17:22:11

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/toybughookcwskvep8im.png)
 
If you have any idea about what organizations will participate in Google Summer of code 2022 please mention it in the comments 

Do you know which project will participate in GSoC 22 please put it in the comments below too ?

Thanks for your attention
How to publish a PWA to the iOS App Store
Tags: ios, pwa
Published: 2021-11-28 17:35:47

---
title: How to publish a PWA to the iOS App Store
published: true
date: 2021-11-28 17:03:02 UTC
tags: ios,pwa
canonical_url: https://relatablecode.com/how-to-publish-a-pwa-to-the-ios-app-store/
---

[PWABuilder.com](http://PWABuilder.com) is a site that allows you to link your PWA and generate files to publish it to various different app stores. I previously used it to create the files necessary to publish my app to the Google Playstore and the Windows Store. Recently an option was added for the App Store as well!

DISCLAIMER: I’m only aware of being able to do this on a MAC OS as it is required to use XCODE to bundle and ship off the software to App Store Connect. If there is a method with Windows mention it in the comments!

### PWABuilder

![PWABuilder Url Input](https://cdn-images-1.medium.com/max/447/0*SPRJjz2AxOCHG_8l)
_PWABuilder URL Input_

Firstly, let’s navigate to PWABuilder.com and enter the corresponding URL in the input above. Afterward, some basic stats are provided. By hitting the next button we can now start generating the files.

![PWABuilder iOS Option](https://cdn-images-1.medium.com/max/805/0*IvQZ_dce0TOJl5WD)
_PWABuilder iOS Option_

Next, hit the store package option for iOS.

In the generated folder the team at PWABuilder included a next-step guide to work through the process of generating package:

[https://github.com/pwa-builder/pwabuilder-ios/blob/main/next-steps.md](https://github.com/pwa-builder/pwabuilder-ios/blob/main/next-steps.md)

Follow through the steps and you’ll be able to begin the publishing process! Do note that to be able to publish an app in the App Store a developer license must be purchased.

This is an example of my own personal app being published:

![My app](https://cdn-images-1.medium.com/max/398/0*GUR1QNQvCzyoW7p2)

If you try this out let me know how it goes in the comments below!

More content at [Relatable Code](https://relatablecode.com)

_Originally published at_ [_https://relatablecode.com_](https://relatablecode.com/how-to-publish-a-pwa-to-the-ios-app-store/) _on November 28, 2021._