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 'react-native'; | |
import React from 'react'; | |
import App from '../App'; | |
// Note: test renderer must be required after react-native. | |
import { createRenderer } from 'react-test-renderer/shallow'; | |
it('should render correctly', () => { | |
let renderer = createRenderer(); | |
renderer.render(<App />); |
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 { useEffect, useState } from 'react'; | |
let loadedScripts: Map<string, Promise<null>> = new Map(); | |
export default function useScript(src: string) { | |
let [isLoaded, setLoaded] = useState(false); | |
useEffect(() => { | |
let promise = loadedScripts.get(src) || loadScript(src); | |
promise.then(() => { | |
setLoaded(true); |
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 { useCallback, useState, useRef } from 'react'; | |
export function useDebounce<T>(initialValue: T, ms: number) { | |
let [value, setValue] = useState(initialValue); | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
let timeout = useRef<any>(); | |
let debouncedSetter = useCallback( | |
(newValue: T) => { | |
clearTimeout(timeout.current); | |
timeout.current = setTimeout(() => { |
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 type JsonPrimitive = null | boolean | number | string; | |
export type JsonArray = Array<JsonValue>; | |
export type JsonObject = { [key: string]: JsonValue }; | |
export type JsonValue = JsonPrimitive | JsonArray | JsonObject; |
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
{ | |
"jest": { | |
"preset": "jest-expo", | |
"transform": { | |
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js", | |
"^.+\\.tsx?$": "ts-jest" | |
}, | |
"testMatch": [ | |
"**/__tests__/**/*.ts?(x)", | |
"**/?(*.)+(spec|test).ts?(x)" |
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
// node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.default = void 0; | |
function _helperPluginUtils() { |
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
@echo off | |
cd "%~dp0" | |
backup-mysql.cmd | |
backup-mssql.cmd |
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
// @flow | |
import fs from 'fs'; | |
import {join} from 'path'; | |
async function main() { | |
let filePath = join(__dirname, '../assets/image.jpg'); | |
// The first one uses Promise-based readable stream. | |
await getFileSizeOne(filePath); | |
// The second one uses "for await" async iterator approach. | |
await getFileSizeTwo(filePath); |
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
// @flow | |
/* global fetch */ | |
/* eslint-disable babel/no-await-in-loop */ | |
type JSONData = null | string | number | boolean | {[key: string]: JSONData} | Array<JSONData>; | |
function handleResponseJSON(response: Response): Promise<JSONData> { | |
return response.json(); | |
} |
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
/*! | |
* HTML Parser | |
* Ported from CKEditor 4.2 (f74e558351) | |
* | |
*/ | |
/*global require, exports, module, define */ | |
var HTMLParser; | |
(function(definition) { | |
if (typeof exports == 'object' && typeof module == 'object') { | |
// CommonJS/Node |