Prerequisites: An existing React app.

You can find the full source code @ github: https://github.com/alexadam/project-templates/tree/master/projects/react-app-tests

Setup

Install Jest and react-testing-library

yarn add --dev jest @types/jest ts-jest @testing-library/react @testing-library/jest-dom

In the project’s root folder, create a file named jest.config.js and add:

module.exports = {
roots: ["./src"],
transform: {…

A step by step guide on how to install Swift on Ubuntu 20.04.

Setup

Download Swift from https://swift.org/download/ -> select the Toolchain archive for Ubuntu 20.04

Extract the archive, then open ~/.bashrc and append this line:

PATH="/.../<absolute-path-to-the-extracted-swift-folder>/usr/bin:$PATH"

Reload .bashrc with source ~/.bashrc

Install the required dependencies. See https://swift.org/download/#using-downloads -> Linux ->…

How to encrypt text

Create a file named encdec.js and paste:

const crypto = require("crypto")const encrypt = (plainText, password) => {
try {
const iv = crypto.randomBytes(16);
const key = crypto.createHash('sha256').update(password).digest('base64').substr(0, 32);
const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
let encrypted = cipher.update(plainText);
encrypted = Buffer.concat([encrypted, cipher.final()])
return iv.toString('hex') + ':' + encrypted.toString('hex');

A step by step guide on how to create a React project from scratch, with TypeScript and Webpack.

You can find the full source code here: https://github.com/alexadam/project-templates/tree/master/projects/react-app

Setup

Prerequisites:

  • node
  • yarn

Create the project’s folder:

mkdir react-app 
cd react-app

Generate a default package.json file with yarn:

yarn init -y

Install React…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store