- install https://github.com/pahen/madge
madge --circular --image circularDependencies.png --extensions ts,js,jsx,tsx path/app
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
@mixin byPlatform($type) { | |
@if $type == 'mobile' { | |
font-size: 8px; | |
line-height: 10px; | |
} | |
@if $type == 'table' { | |
font-size: 12x; | |
line-height: 15px; | |
} |
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 ALIGN_LEFT = 'left' | |
const ALIGN_RIGHT = 'right' | |
type AlignUnion = typeof ALIGN_LEFT | typeof ALIGN_RIGHT | |
const foo: AlignUnion = 'bar' | |
const foo1: AlignUnion = 'left' | |
const foo2: AlignUnion = ALIGN_LEFT | |
enum AlignEnum { |
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
Search: | |
export const dispatchToProps = \{((.|\n)+)\}; | |
Replace: | |
export const dispatchToProps = () => ({$1}); | |
Or: | |
export const dispatchToProps = \{(.*?)\}; |
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
// Attempt 1 | |
function decodeJson(json: unknown) { | |
return <A, R>( | |
expectedInput: Decoder<unknown, A>, | |
expectedOutput: Decoder<unknown, R>, | |
fn: (a: A) => R | |
): Either.Either<Decoding, R> => { | |
pipe( | |
json, |
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
{ | |
"scripts": { | |
"prettier:check": "./bin/prettier.sh --check", | |
"prettier:fix": "./bin/prettier.sh --write", | |
} | |
} |
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
[ | |
{ | |
"id": "1", | |
"name": "Bella Italia", | |
"menu": [ | |
{ | |
"name": "🍕 4 formaggi", | |
"price": 10 | |
}, | |
{ |
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 container = document.getElementById('container') | |
const percentage = 50 | |
// getComputedStyle in case container has borders | |
const containerWidth = parseInt(getComputedStyle(container, null).width, 10) | |
container.scrollLeft = ((container.scrollWidth - containerWidth) / 100 ) * percentage |
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 { useState, useEffect } from 'react' | |
export enum ColorScheme { | |
Dark = 'dark', | |
Light = 'light', | |
NoPreference = 'no-preference', | |
} | |
export const useIsColorScheme = (colorScheme: ColorScheme) => { | |
const [isColorScheme, setIsColorScheme] = useState<boolean>(false) |
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 FilteredKeys<T, U> = { [P in keyof T]: T[P] extends U ? P : never }[keyof T] | |
const compare = <T>(fn: (x: T, y: T) => number) => <O extends object>(key: FilteredKeys<O, T>) => ( | |
a: O, | |
b: O, | |
): number => { | |
const valA = (a[key] as unknown) as T | |
const valB = (b[key] as unknown) as T | |
return fn(valA, valB) |