Skip to content

Instantly share code, notes, and snippets.

View marlondenisck's full-sized avatar

marlon marlondenisck

View GitHub Profile

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@marlondenisck
marlondenisck / env-file-in-react-create-app.md
Created August 5, 2023 15:49 — forked from Haugen/env-file-in-react-create-app.md
Using .env file environment variables with create-react-app project

For a simple way to use environment variables in your react-create-app project, follow these steps:

  1. Create a new file named .env in the root of your project.
  2. In your new .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=abcdefg123456789
  3. Restart your server development server. In order for React to find and register your newly created environment variable you must restart your server. Do this every time you add or change a variable.
  4. Your new variables will now be available throughout your React app via the global process.env object. In our case, we could get our API key using process.env.REACT_APP_API_KEY.

Additinal notes

  • Since we commonly store secrets in .env you probably want to add it to .gitignore.
  • You don't need to install the dotenv package or anything else for this to work.
@marlondenisck
marlondenisck / readme.md
Created October 16, 2022 22:19 — forked from kuhelbeher/readme.md
Eslint airbnb config + prettier for create-react-app project

This is tutorial of onfiguring eslint, prettier for your project

Make your code great again

  1. Eslint

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
@marlondenisck
marlondenisck / ComposeProviders.tsx
Created September 6, 2022 17:39 — forked from Luisgustavom1/ComposeProviders.tsx
Compose React Providers to avoid too much chaining
import React from 'react'
interface IComposeProvidersProps {
with: Array<React.ElementType>
children: React.ReactNode
}
export const ComposeProviders = ({
with: Providers,
children,
@marlondenisck
marlondenisck / ComposeProviders.tsx
Created September 6, 2022 17:39 — forked from sciotta/ComposeProviders.tsx
Compose React Providers to avoid too much chaining
import React from 'react'
interface IProviderProps {
component: React.ElementType,
props?: Record<string, any>,
}
interface IComposeProvidersProps {
with: Array<IProviderProps>,
children: React.ReactNode,
@marlondenisck
marlondenisck / Git-Emergencia.md
Last active November 15, 2021 17:59
Git Emergencia.md

Escreveu mensagem de commit errada?

  • Isso aqui vai alterar a mensagem do último commit:
git commit --amend -m "nova mensagem de commit"

@marlondenisck
marlondenisck / youtube-video-analytics.js
Created October 1, 2021 13:10 — forked from ErickWendel/youtube-video-analytics.js
Example of how to get video views from youtube
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)
@marlondenisck
marlondenisck / linkedin-post-analytics-example.mjs
Created October 1, 2021 13:08 — forked from ErickWendel/linkedin-post-analytics-example.mjs
Example of how to get post Analytics such as Views from a Linkedin post
// 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 = {
@marlondenisck
marlondenisck / main.sh
Created November 13, 2020 23:21
Disable Spotlight indexer
# 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