sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
For a simple way to use environment variables in your react-create-app project, follow these steps:
.env in the root of your project..env file, add a new key=value pair. For security reasons, you must prepend your key with REACT_APP, for example REACT_APP_API_KEY=abcdefg123456789process.env object. In our case, we could get our API key using process.env.REACT_APP_API_KEY..env you probably want to add it to .gitignore.dotenv package or anything else for this to work.| let users = ourStore.users; | |
| let stringWithUsername = "Hello @efog, how do you feel today?"; | |
| let processed = processString([{ | |
| regex: /\@([a-z0-9_\-]+?)( |\,|$|\.)/gim, //regex to match a username | |
| fn: (key, result) => { | |
| let username = result[1]; | |
| let foundUsers = users.filter(user => user.username === username); | |
| if (!foundUsers.length) |
This is tutorial of onfiguring eslint, prettier for your project
Make your code great again
First of all we need to install eslint and configs as dev dependencies. You can use your own config, but I will use config from airbnb:
yarn add -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react| import React from 'react' | |
| interface IComposeProvidersProps { | |
| with: Array<React.ElementType> | |
| children: React.ReactNode | |
| } | |
| export const ComposeProviders = ({ | |
| with: Providers, | |
| children, |
| import React from 'react' | |
| interface IProviderProps { | |
| component: React.ElementType, | |
| props?: Record<string, any>, | |
| } | |
| interface IComposeProvidersProps { | |
| with: Array<IProviderProps>, | |
| children: React.ReactNode, |
| const YOUTUBE_KEY = "YOUR YOUTUBE KEY" | |
| import axios = from 'axios'; | |
| function getVideoId(link) { | |
| const videoId = link.match(/v=(?<videoId>.*)/)?.groups?.videoId | |
| return videoId | |
| } | |
| async function getVideoViews(link) { | |
| const videoId = getVideoId(link) |
| // paste this file on a empty directory | |
| // npm i axios | |
| // You should go to your browser on Cookie session and get JSESSIONID and li_at from Linkedin Section | |
| const JSESSIONID = 'YOUR JSESSIONID' | |
| const liAT = 'YOUR li_at' | |
| import axios from 'axios' | |
| const headers = { |
| # Disable (god damn) Spotlight indexer | |
| # Seems to have eaten my hard drive ~400 GB in just 2 days on Big Sur b6 | |
| sudo mdutil -a -i off |