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
$$\mathbb{N} = \{ 1,2, \dots\}$$ | |
$$\mathbb{Z} = \{ \dots -2, -1, 0, 1,2, \dots\}$$ | |
$$\mathbb{Q} = \{ x | x = \frac{m}{n} | m,n\in \mathbb{N}, n \neq 0\}$$ |
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 * as React from 'react'; | |
export const useIsMounted = (): boolean => { | |
const [isMounted, setIsMounted] = React.useState(false); | |
React.useEffect(() => setIsMounted(true), []); | |
return isMounted; | |
}; |
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 [a, b, c] = [await aPromise, await bPromise, await cPromise]; |
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
enum DocStatus { | |
OPEN = "OPEN", | |
WON = "WON", | |
DRAFT = "DRAFT", | |
OVERDUE = "OVERDUE", | |
CANCELED = "CANCELED", | |
}; | |
interface Doc { | |
readonly id: 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
import React, { useEffect, useState } from 'react'; | |
import { usePromiseEffect } from './usePromiseEffect'; | |
const ToggleMount = () => { | |
const [fetched, setFetched] = useState(false); | |
const callbacks = { | |
resolve: (res) => { | |
setFetched(true); | |
}, |
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
# append changes to last commit | |
git config --global alias.append 'commit --amend --no-edit' | |
# print current branch name | |
git config --global alias.current 'rev-parse --abbrev-ref HEAD' | |
# fetch develop and merge in current branch | |
git config --global alias.goodmorning '!git fetch origin ${1-develop} && git merge origin/${1-develop}' | |
# delete all local branches but nor [BranchName] (default is develop) |
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
git config --global alias.current 'rev-parse --abbrev-ref HEAD' | |
# get current branch name | |
rev-parse --abbrev-ref HEAD | |
git branch | grep \* | cut -d ' ' -f2 |
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 compose = (...fns) => x => fns.reduce((v, f) => f(v), x); | |
const all = xs => xs.reduce((acc, x) => ((!x) ? x : acc), true); | |
const any = xs => xs.reduce((acc, x) => (x || acc), false); | |
const not = x => !xs; |
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 System.Environment | |
import Data.List | |
type AttrName = String | |
type AttrVal = String | |
newtype TagName = TagName String deriving (Show) | |
data Attr = Attr AttrName AttrVal | |
listToStr :: (Show a) => [a] -> 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
module Main where | |
import System.Environment | |
grey = "\x1b[2m" | |
noColor = "\x1b[0m" | |
replLine 0 = (grey ++ "> Hi!" ++ noColor) | |
replLine _ = (grey ++ ">" ++ noColor) |