Install, build and debug a react native app in WSL2 (Windows Subsystem for Linux) and Ubuntu.
This file contains hidden or 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 { AnyZodObject, z } from 'zod' | |
import { Metadata, ResolvingMetadata } from 'next' | |
type InferParams<Params> = Params extends readonly string[] | |
? { | |
[K in Params[number]]: string | |
} | |
: Params extends AnyZodObject | |
? z.infer<Params> | |
: unknown |
This file contains hidden or 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
// | |
// ContentView.swift | |
// FetchAsync | |
// | |
// Created by Gabriel Zawalski on 09/11/23. | |
// | |
import SwiftUI | |
struct ContentView: View { |
This file contains hidden or 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 Recipient = require('mailersend').Recipient; | |
const EmailParams = require('mailersend').EmailParams; | |
const BulkEmails = require('mailersend').BulkEmails; | |
const MailerSend = require('mailersend'); | |
const users = require('./users'); | |
const MAILERSEND_API_KEY = process.env.MAILERSEND_API_KEY; | |
if (!MAILERSEND_API_KEY) { | |
console.error('MAILERSEND_API_KEY is required'); |
This file contains hidden or 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 React, { useEffect, useMemo, useCallback, useLayoutEffect, useState } from "react"; | |
import { EditorView } from "@codemirror/view"; | |
import { EditorState, Compartment, EditorStateConfig, StateEffect, Extension } from "@codemirror/state"; | |
import { indentUnit } from "@codemirror/language"; | |
/** creates an editor view from an initial state - destroys the view on cleanup */ | |
export function useEditorView(initState: (() => EditorStateConfig) | EditorStateConfig = {}): EditorView { | |
const view = useMemo( | |
() => new EditorView({ state: EditorState.create(typeof initState === "function" ? initState() : initState) }), | |
[] |
This file contains hidden or 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 default function createCrudHooks({ | |
baseKey, | |
indexFn, | |
singleFn, | |
createFn, | |
updateFn, | |
deleteFn, | |
}) { | |
const useIndex = (config) => useQuery([baseKey], indexFn, config) | |
const useSingle = (id, config) => |
This file contains hidden or 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
OBS: O var_number_int é a varável que recebera o valor a ser convertido em DP | |
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, var_number_int, getResources().getDisplayMetrics()) | |
##KOTLIN | |
val Int.dp: Int | |
get() = (this * Resources.getSystem().displayMetrics.density + 0.5f).toInt() | |
val Float.dp: Int |
This file contains hidden or 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
// Check if rectangle a contains rectangle b | |
// Each object (a and b) should have 2 properties to represent the | |
// top-left corner (x1, y1) and 2 for the bottom-right corner (x2, y2). | |
function contains(a, b) { | |
return !( | |
b.x1 < a.x1 || | |
b.y1 < a.y1 || | |
b.x2 > a.x2 || | |
b.y2 > a.y2 | |
); |