Skip to content

Instantly share code, notes, and snippets.

View pedrouid's full-sized avatar
🛠️
Building @WalletConnect

Pedro Gomes pedrouid

🛠️
Building @WalletConnect
View GitHub Profile
@pedrouid
pedrouid / package-version-react-app.md
Last active January 29, 2019 16:39
Display package.json version on React app (using environment variables)

Display package.json version on React app

  1. Create .env file on the root directory
REACT_APP_VERSION=$npm_package_version
  1. Access from environment variables on React app
const version = process.env.REACT_APP_VERSION
@pedrouid
pedrouid / iso-639-1.json
Last active August 23, 2022 22:41
ISO-639-1 Languages (including matching ISO-639-1, ISO-639-2B, ISO-639-2T and ISO-639-3 codes)
[
{
"name": "Afar",
"type": "living",
"scope": "individual",
"iso-639-3": "aar",
"iso-639-2B": "aar",
"iso-639-2T": "aar",
"iso-639-1": "aa"
},
@pedrouid
pedrouid / did:muport:QmQ3fkGTPi7wWSFqMBr9fTf4b4BRtLQXDHoiABGNjmf4MV
Created January 19, 2019 22:40
did:muport:QmQ3fkGTPi7wWSFqMBr9fTf4b4BRtLQXDHoiABGNjmf4MV
did:muport:QmQ3fkGTPi7wWSFqMBr9fTf4b4BRtLQXDHoiABGNjmf4MV
@pedrouid
pedrouid / .profile
Created January 19, 2019 14:00
Create React & React-Native Apps with react-scripts-ts
create-react-app-ts() {
if [ -n "$1" ]
then
create-react-app "$1" --scripts-version=react-scripts-ts
else
echo "Error: create-react-app-ts requires at least one argument (project_name)"
fi
cd "$1"
}
@pedrouid
pedrouid / how-to-use-web3-with-react-native.md
Created January 11, 2019 16:04
How to set up web3.js (Ethereum JS API) with Create React Native App

How to set up web3.js with CRNA

This is a simple guide to get you started with using the Ethereum Javascript API (web3.js) with the Create React Native App project. This is not an in-depth guide.

TL;DR

If you are lazy and just want to get started, I have this project ready for you. It should work out-of-the-box.

Installation guide

  1. Make sure you have Node version 6 or later installed, if not, get it on the Node website
@pedrouid
pedrouid / crypto-in-react-native.md
Last active January 18, 2019 15:14
Using crypto NodeJS module polyfill in React-Native (step-by-step)

Using crypto NodeJS module in React-Native (step-by-step)

This tutorial will show you how to polyfill crypto and other NodeJS modules globally in a React-Native environment. Please note that these implementations are purely javascript and don't use native modules to generate random numbers

Step 1 - Install dependencies

Run the following command

@pedrouid
pedrouid / concatBuffer.js
Last active December 17, 2018 18:17
Concat ArrayBuffers
function concatBuffer(b1, b2) {
let r = new Uint8Array(b1.byteLength + b2.byteLength);
r.set(new Uint8Array(b1), 0);
r.set(new Uint8Array(b2), b1.byteLength);
return r.buffer;
};
@pedrouid
pedrouid / uuid.js
Created December 17, 2018 14:46
UUID Generator (Javascript) | 110 bytes
function b(a){return a?(a^Math.random()*16>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,b)}
@pedrouid
pedrouid / setup-ssl.md
Last active April 29, 2024 21:39
Setup SSL with NGINX reverse proxy

Get a Free SSL Certificate With Let’s Encrypt

Let’s Encrypt is a free, automated, and open Certificate Authority.

  1. Install tools for using the Let's Encrypt certificates using Certbot
  sudo apt-get update \
  sudo apt-get install software-properties-common
@pedrouid
pedrouid / webcrypto-examples.md
Created December 15, 2018 01:07
Web Cryptography API Examples