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
| type EventTypes = 'rateLimitExceeded' | 'rateLimitDismissed' | |
| function simplePubSub() { | |
| const callbacks = new Map<symbol, (event: EventTypes) => void> | |
| return { | |
| subscribe: (callback: (event: EventTypes) => void) => { | |
| const key = Symbol() | |
| callbacks.set(key, callback); | |
| return () => callbacks.delete(key) |
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 { stdin as input, stdout as output } from 'process'; | |
| import { emitKeypressEvents } from 'readline'; | |
| function clearConsole(lengthOfOptions) { | |
| //adapted from sindresorhus ansi-escape module | |
| const ESC = '\u001B[' | |
| const eraseLine = ESC + '2K'; | |
| const cursorUp = (count = 1) => ESC + count + 'A' | |
| const cursorLeft = ESC + 'G' |
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
| /** | |
| * Isso é uma factory function, basicamente é como se tivesse instanciando uma classe, mas faço isso com function, | |
| * prefiro esse padrão do que usar classes. Eu tenho que chamar essa função globalmente antes de começar o app. | |
| * | |
| * IMPORTANTE: Não demorei nem 10 minutos fazendo essa porcaria, então sei lá, recomendo algo mais parrudão pra usar em prod. | |
| * Principalmente algo com tipagem melhor que vc consiga listar os eventos disponiveis e os parâmetros que cada callback recebe. | |
| */ | |
| function simplePubSubFactory() { | |
| const subscribed = new Map<string, Map<symbol, (...args: any[]) => void>> |
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 { AppState, Linking } from "react-native"; | |
| import { useEffect, useRef, useState } from "react"; | |
| import { Audio, InterruptionModeIOS } from "expo-av"; | |
| import { getNetworkStateAsync } from "expo-network"; | |
| import Voice, { | |
| SpeechRecognizedEvent, | |
| SpeechResultsEvent, | |
| } from "@react-native-voice/voice"; | |
| import BackgroundTimer from "react-native-background-timer"; |
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
| { | |
| "app_id": 1966818, | |
| "billing_address": { | |
| "address1": "2259 Park Ct", | |
| "address2": "Apartment 5", | |
| "city": "Drayton Valley", | |
| "company": null, | |
| "country": "Canada", | |
| "first_name": "Christopher", | |
| "last_name": "Gorski", |
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
| /** | |
| * This function exists to allow us to use setTimeout in a way that doesn't block the UI thread. | |
| * | |
| * Instead of using setTimeout, we use requestAnimationFrame to call the function recursively until the timeout is reached. | |
| * | |
| * This will enable us to render smooth animations while the timeout is running. | |
| */ | |
| export function setLayoutTimeout( | |
| callback: (...args: any) => any, | |
| timeout: number, |
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 { AppState, Linking } from "react-native"; | |
| import { useEffect, useRef, useState } from "react"; | |
| import { Audio, InterruptionModeIOS } from "expo-av"; | |
| import { getNetworkStateAsync } from "expo-network"; | |
| import { uuid, logging } from "../utils"; | |
| import { | |
| SNIPPET_LENGTH_IN_MILLISECONDS, | |
| setLayoutTimeout, | |
| clearLayoutTimeout, |
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 puppeteer, { Page } from "puppeteer"; | |
| const INSTAGRAM_HOST = "https://www.instagram.com/"; | |
| export default async function instagram( | |
| username: string, | |
| password: string, | |
| options?: { headless: boolean } | |
| ) { | |
| const [page, browser] = await initialize(); |
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
| var customerRefund = nlapiCreateRecord('customerrefund'); | |
| customerRefund.setFieldValue('customer', '111736'); | |
| customerRefund.setFieldValue('currency', '1'); | |
| customerRefund.setFieldValue('account', '217'); | |
| customerRefund.setFieldValue('trandate', new Date()); | |
| customerRefund.setFieldValue('paymentmethod', '14'); | |
| const creditCount = customerRefund.getLineItemCount('apply'); | |
| const creditMemoIndex = customerRefund.findLineItemValue('apply', 'internalid', '4498596'); |
NewerOlder