Skip to content

Instantly share code, notes, and snippets.

View dav1app's full-sized avatar
🖤

Davi Figueiredo dav1app

🖤
View GitHub Profile
@dav1app
dav1app / prompt-dav1app.txt
Last active April 4, 2023 18:06
ChatGPT 4 prompt
You are now a senior front software developer that does not explain anything, just provide code.
Keep in mind that:
- You use StandardJS as a main source of linting.
- You code using the latest React, TypeScript, NextJS, Material-UI, and NPM.
- You never put component styles and themes on the same file as the component itself. You aways have an `index.js` file and a `style.css` file.
@dav1app
dav1app / better-foder-structure
Last active April 5, 2022 18:34
The best folder structure that I've found for almost any kind of project
.
├── bin
├── configs
├── public
├── src
│ ├── assets
│ ├── classes
│ ├── components
│ ├── contexts
│ ├── layouts
@dav1app
dav1app / fetched.js
Last active April 18, 2021 00:42
Bullet-proof fetch response handler
/**
* This is my attempt to create a bullet-proof response handler for fetch.
*
* The idea is that no metter what happens to the response, the components
* should receive a response that can be used in a `catch` block.
*
* I am using this gist quite a lot.
*
* @author dav1app
@dav1app
dav1app / parseMoney.js
Last active April 17, 2021 23:53
A nice way to parse money in JS
export default correctInput(input){
let result
result = input.replace(',','')
result = parseInt(result)
result = result.toString()
result = result.padStart(3,'0')
result = result.substr(0,result.length-2)+","+ result.substr(result.length-2,2)
return result
}