This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FieldPolicy } from '@apollo/client'; | |
type TExistingShortMedia<TNode> = { | |
edges: TNode[]; | |
_search: string; | |
totalCount: number; | |
count: number; | |
totalPages: number; | |
hasNextPage: boolean; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:lts as builder | |
ENV NODE_ENV=production | |
WORKDIR /app | |
COPY package.json /app | |
COPY yarn.lock /app | |
COPY tsconfig.base.json /app | |
COPY /apps /app/apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
dado o seguinte cenário, um objeto que pode ter valores aninhados até 2 níveis, | |
deve-se remover a chave do primeiro nível se alguma das chaves aninhadas | |
for (undefined ou {} ou '' ou null) - 0 não conta | |
*/ | |
const isObject = (v) => typeof v === 'object' && !Array.isArray(v) | |
const isEmptyObject = (obj) => isObject(obj) && (Object.keys(obj).length === 0) | |
const isNull = (v) => v === '' || v === null || v === undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FIREBASE_API_KEY = process.env.FIREBASE_API_KEY; | |
const FIREBASE_EMAIL = process.env.FIREBASE_EMAIL; | |
const FIREBASE_PASSWORD = process.env.FIREBASE_PASSWORD; | |
const FIREBASE_AUTH_URL = `https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=${ FIREBASE_API_KEY }`; | |
const method = "POST" | |
const body = { | |
email: FIREBASE_EMAIL, | |
password: FIREBASE_PASSWORD, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
branch="$(git rev-parse --abbrev-ref HEAD)" | |
if [ "$branch" = "main" ] || [ "$branch" = "dev" ]; then | |
echo "You can't commit directly to the \"$branch\" branch, please checkout to a new branch before committing" | |
exit 1 | |
f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const hasBit = (bit, bitfield) => (bitfield & bit) === bit; | |
export const addBit = (bit, bitfield) => bitfield | bit; | |
export const removeBit = (bit, bitfield) => bitfield & ~bit; | |
export const addOrRemoveBit = (bit, bitfield) => addBit(bit, bitfield) ? removeBit(bit, bitfield) : addBit(bit, bitfield); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Base { | |
a: unknown; | |
b: unknown; | |
c: unknown; | |
foo(): unknown; | |
bar(): unknown; | |
} | |
type RemoveMethods<T> = { [P in keyof T as T[P] extends (...args: any) => any ? never : P]: T[P] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Counter do | |
use GenServer | |
def start_link(_) do | |
GenServer.start_link(__MODULE__, 0, name: __MODULE__) | |
end | |
@impl true | |
def init(initial), do: {:ok, initial} |