code --install-extension aaron-bond.better-comments
code --install-extension Angular.ng-template
code --install-extension bradlc.vscode-tailwindcss
code --install-extension csstools.postcss
code --install-extension dbaeumer.vscode-eslint
code --install-extension EditorConfig.EditorConfig
code --install-extension esbenp.prettier-vscode
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 { FC, HTMLAttributes } from "react"; | |
type BoxProps = { | |
as?: keyof JSX.IntrinsicElements; | |
} & HTMLAttributes<HTMLOrSVGElement>; | |
export const Box: FC<BoxProps> = ({ as: Component = "div", ...props }) => { | |
return <Component {...props} />; | |
}; |
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
// src/getPaginationMeta.ts | |
var getPreviousEnabled = (currentPage) => currentPage > 0; | |
var getNextEnabled = (currentPage, totalPages) => currentPage + 1 < totalPages; | |
var getTotalPages = (totalItems, pageSize) => Math.ceil(totalItems / pageSize); | |
var getStartIndex = (pageSize, currentPage) => pageSize * currentPage; | |
var getEndIndex = (pageSize, currentPage, totalItems) => { | |
const lastPageEndIndex = pageSize * (currentPage + 1); | |
if (lastPageEndIndex > totalItems) { | |
return totalItems - 1; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>KeyboardEvent</title> | |
<meta charset="UTF-8" /> | |
<script> | |
document.addEventListener("keydown", function (evt) { | |
if (evt.keyCode === 65 && evt.shiftKey) { | |
alert("SHIFT + A pressed"); |
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
Windows Registry Editor Version 5.00 | |
;=== Disable === | |
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] | |
"AutoConfigURL"=- | |
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap] | |
"ProxyBypass"=dword:00000001 | |
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1] |
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 date = new Intl.DateTimeFormat('en', { | |
year: 'numeric', | |
hour: 'numeric', | |
minute: 'numeric', | |
second: 'numeric', | |
day: '2-digit', | |
month: '2-digit', | |
hour12: 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
/** | |
* Use like this: | |
* | |
* pluralize(2)`package${['s']}` | |
* // packages | |
* | |
* pluralize(1)`package${['s']}` | |
* // package | |
* | |
* pluralize(2)`agenc${['ies', 'y']}` |
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
function cakes(recipe, available) { | |
return Object | |
.keys(recipe) | |
.reduce((acc, ingredient) => { | |
const cakes = Math.floor( | |
available[ingredient] / | |
recipe[ingredient] || 0 | |
) | |
return Math.min(cakes, acc) |
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
export default async function fetcher<T = unknown>( | |
input: RequestInfo, | |
init?: RequestInit | |
): Promise<T> { | |
const response = await fetch(input, init) | |
const data = await response.json() as T | |
if (response.ok) { | |
return data | |
} |