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
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
export type Result<T, E> = [T, undefined] | [undefined, E]; | |
/** | |
* Handle errors more declaratively without try catch. | |
* | |
* ``` | |
* try { | |
* const res = doSomething(30); | |
* } catch (err) { |
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
type Decr = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | |
type Obj = Record<string, unknown>; | |
type Prettify<T> = { | |
[K in keyof T]: T[K]; | |
} & NonNullable<unknown>; | |
type ValuesOf<T> = T[keyof T]; |
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 {getContext, setContext} from 'svelte'; | |
interface Context<TValue> { | |
get: () => TValue | null; | |
set: (currentValue: TValue) => void; | |
} | |
/** | |
* Allow strongly typed Svelte context getters and setters while using a unique | |
* Symbol instead of a string key to avoid any potential key conflicts. |
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 {Anchor, Button, H1, Paragraph, Separator, Sheet, Theme, XStack, YStack} from '@slipbox/ui'; | |
import {ChevronDown, ChevronUp} from '@tamagui/lucide-icons'; | |
import {useState} from 'react'; | |
function SheetDemo() { | |
const [open, setOpen] = useState(false); | |
const [position, setPosition] = useState(0); | |
return ( | |
<> | |
<Button |
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
require_relative '../node_modules/react-native/scripts/react_native_pods' | |
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' | |
platform :ios, '12.4' | |
install! 'cocoapods', :deterministic_uuids => false | |
production = ENV["PRODUCTION"] == "1" | |
target 'Wave' do | |
pod 'Firebase', :modular_headers => 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
find $1 -name "*.jpg" -exec bash -c $'file="{}"; npx @squoosh/cli --webp \'{"quality":75,"target_size":0,"target_PSNR":0,"method":4,"sns_strength":50,"filter_strength":60,"filter_sharpness":0,"filter_type":1,"partitions":0,"segments":4,"pass":1,"show_compressed":0,"preprocessing":0,"autofilter":0,"partition_limit":0,"alpha_compression":1,"alpha_filtering":1,"alpha_quality":100,"lossless":0,"exact":0,"image_hint":0,"emulate_jpeg_size":0,"thread_level":0,"low_memory":0,"near_lossless":100,"use_delta_palette":0,"use_sharp_yuv":0}\' -d ./output/ "$file"' \; |
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
type ReturnTypes<T extends Array<(...a: any[]) => any>> = { | |
[P in keyof T]: T[P] extends (...a: any[]) => infer R ? R : never | |
} |
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 typing import Type, TypeVar | |
T = TypeVar('T', bound='TrivialClass') | |
class TrivialClass: | |
# ... | |
@classmethod | |
def from_int(cls: Type[T], int_arg: int) -> T: | |
# ... |
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 path = require('path'); | |
const postcss = require('postcss'); | |
const preprocess = require('svelte-preprocess'); | |
const replaceFileExtension = (filePath, newExtension) => { | |
const { name, root, dir } = path.parse(filePath); | |
return path.format({ | |
name, | |
root, | |
dir, |
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
<script lang="ts"> | |
type T = $$Generic | |
interface $$Slots { | |
default: { // slot name | |
item: T | |
index: number | |
} | |
} | |
export let items: T[] = [] | |
</script> |
NewerOlder