Skip to content

Instantly share code, notes, and snippets.

View luiznasciment0's full-sized avatar
💻
coding

Luiz Nascimento luiznasciment0

💻
coding
View GitHub Profile
type AnyFunction = (...args: any[]) => any
function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error("Cannot call an event handler while rendering.")
})
// Or useInsertionEffect if it's React 18
useLayoutEffect(() => {
ref.current = callback
})
<div id="canvas"></div>
<style>
#canvas {
width: 500px;
height: 300px;
border: 5px solid black;
position: relative;
box-sizing: content-box;
}
const text = css({
color: '$gray12',
variants: {
size: {
// corrective letter-spacing and text-indent styles
// should go here too, because they're determined by font-size.
// You could also put line-height here too, if your devs prefer
// a default line-height that works in some cases. But understand
// that line-height is also a function of line-length, so the
@antoniel
antoniel / Contra.tsx
Last active September 29, 2021 00:09
import { Suspense } from "react";
import graphql from "babel-plugin-relay/macro";
import {
RelayEnvironmentProvider,
loadQuery,
usePreloadedQuery,
} from "react-relay/hooks";
import { ErrorBoundary } from "react-error-boundary";
import RelayEnvironment from "./RelayEnvironment";
@sibelius
sibelius / learning-path-web3.md
Last active August 21, 2024 01:08
Learning Path Web3
  • learn blockchain concepts
  • learn ethereum
  • learn how to use metamask
  • learn how to use hardhat (https://hardhat.org/)
  • learn how to deploy and interact with a smart contract
  • learn common smart contract standards like ERC20 (token), ERC721 (nft), ERC1155 (opensea)
  • learn ipfs
  • learn how to read blockchain explorers like https://etherscan.io/
  • learn how to use web3 and etherjs
  • learn solidity
defmodule Mergesort do
def merge_sort([]), do: []
def merge_sort(list) do
list
|> Enum.map(fn x -> [x] end)
|> merge_lists()
end
def merge_lists([list]), do: list
@luiznasciment0
luiznasciment0 / omitKeys.ts
Last active June 29, 2021 02:36
omitKeys
const cloneObject = <TObject extends { [key: string]: unknown }>(object: TObject): TObject =>
JSON.parse(JSON.stringify(object))
/*
* Essa função serve para remover propriedades de um objeto sem a necessidade de fazer mutações
* Dessa forma, você não perde a referência do objeto original se precisar utilizá-lo posteriormente
*
*
@param
object - O objeto que você quer remover uma propriedade.
*
@sibelius
sibelius / entria.md
Last active April 22, 2021 01:05
Things that you gonna learn at Entria

Most job post are about requirements that you should already know.

We think that you should learn a lot when working for a company.

So here is a list of many things that you are going to learn while working for us (and many more):

  • how to use git to work in a team
  • how to contribute to open source projects
  • how to manage .env files (configurations)
  • local vs staging vs production environments
@akinncar
akinncar / reactJsLearningPath.md
Last active May 12, 2022 00:14
ReactJs Learning Path - Basics that you should learn
  • learn how to build JSX basic components
  • learn component props
  • learn how to manage state
  • learn basic hooks (useState and useEffect)
  • learn how to fetch Rest API's (Axios, SWR)
  • learn how to use routes with React Router DOM
  • learn how to manage global state (Context API, Redux, MobX)
  • learn how to make unit tests with Jest
  • learn how to use GraphQL (Apollo, Relay)
@sibelius
sibelius / backendLearningPath.md
Created January 15, 2021 14:59
Backend Learning Path - Basics that you should learn
  • learn about basic database modelling, use excalidraw
  • learn how to connect to a database and performe queries
  • learn how to expose a CRUD API REST and/or GraphQL
  • learn how to document the API using Swagger, swagger-jsdoc is the best for it
  • learn how to test your API using Postman, and also automated using jest and supertest
  • learn how to consume other APIs using fetch

Also check Docker Learning Path and Lambda Learning Path