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
| // @ts-expect-error - Quagga is not typed | |
| import Quagga from "quagga"; | |
| import { createRef, useCallback, useEffect, useState } from "react"; | |
| import { toError } from "@/components/error/errorUtil"; | |
| import { Button } from "@/components/style/Button"; | |
| export interface BarCodeReaderProps { | |
| onRead: (barcode: string) => 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
| console.log(Math.round((require('child_process').execSync('wmic /namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature').toString().split('\r\n')[1].trim()) / 10 - 273)+ '℃') | |
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 { PayloadAction, configureStore, createSlice } from "@reduxjs/toolkit"; | |
| import type { NextPage } from "next"; | |
| import { Provider, useDispatch, useSelector } from "react-redux"; | |
| import undoable, { StateWithHistory, UndoableOptions } from "redux-undo"; | |
| // partial state for a section (undo target) | |
| interface NumberState { | |
| id: string; | |
| title: string; | |
| value: 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 type { NextPage } from "next"; | |
| import { useState } from "react"; | |
| import { HStack } from "../../src/lib/layout/HStack"; | |
| import { VStack } from "../../src/lib/layout/VStack"; | |
| import { Button } from "../../src/lib/style/Button"; | |
| import { H1 } from "../../src/lib/style/H1"; | |
| import { H2 } from "../../src/lib/style/H2"; | |
| interface Task { | |
| done: boolean; |
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 words = twotabsearchtextbox.value.split(" "); | |
| [...document.querySelectorAll(".s-result-item")] | |
| .filter((v) => !words.every((w) => v.textContent.toLowerCase().includes(w))) | |
| .forEach((v) => v.style.opacity = "0.3") |
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 app = express(); | |
| const _use = app.use; | |
| let numUseCalls = 0; | |
| app.use = function(...args) { | |
| const fn = args[args.length - 1]; | |
| // except `express.static()` | |
| if (fn && fn.name === 'serveStatic') { | |
| _use.apply(this, args); |
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 { useFocusRing } from "@react-aria/focus"; | |
| import { useListBox, useOption } from "@react-aria/listbox"; | |
| import { mergeProps } from "@react-aria/utils"; | |
| import { ListProps, ListState, useListState } from "@react-stately/list"; | |
| import { Node } from "@react-types/shared"; | |
| import { useRef } from "react"; | |
| interface ListBoxProps<T> extends ListProps<T> { | |
| label?: string; | |
| } |
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
| interface FruitMap { | |
| 'Apple': AppleFruit; | |
| 'Banana': BananaFruit; | |
| } | |
| type FruitName = keyof FruitMap; | |
| type Fruit = FruitMap[FruitName] | |
| interface FruitBase<Type extends FruitName> { |
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 FruitTemplate<Type extends string, Props> ={ type: Type } & Props | |
| type Fruit = | |
| | AppleFruit | |
| | BananaFruit | |
| type AppleFruit = FruitTemplate<'Apple', { | |
| sliced: boolean; | |
| peeled: boolean; | |
| }> |
NewerOlder