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
\documentclass[a4paper,10pt]{article} | |
\usepackage[margin=0.5in,nofoot]{geometry} | |
\usepackage{fontawesome5} | |
\usepackage{hyperref} | |
\usepackage{titlesec} | |
\usepackage{xcolor} | |
\hypersetup{ | |
colorlinks=true, | |
linkcolor=blue, |
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 { useEffect, useState } from 'react'; | |
export default function useDebounce(value: string, delay: number) { | |
const [debouncedValue, setDebouncedValue] = useState(value); | |
useEffect(() => { | |
const handler = setTimeout(() => { | |
setDebouncedValue(value); | |
}, delay); |
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
{ | |
"workbench.colorTheme": "Vesper", | |
"workbench.iconTheme": "chalice-icon-theme", | |
"editor.fontSize": 15, | |
"editor.fontWeight": "300", | |
"terminal.explorerKind": "external", | |
"terminal.integrated.fontSize": 20, | |
"terminal.integrated.fontWeight": "300", | |
"editor.glyphMargin": false, | |
"editor.fontFamily": "JetBrains Mono", |
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 createRange = (len, start = 1) => | |
Array(len) | |
.fill(0) | |
.map((_, i) => i + start); |
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
javascript:(function(){ | |
allowCopyAndPaste = function(e){ | |
e.stopImmediatePropagation(); | |
return true; | |
}; | |
document.addEventListener('copy', allowCopyAndPaste, true); | |
document.addEventListener('paste', allowCopyAndPaste, true); | |
document.addEventListener('onpaste', allowCopyAndPaste, 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
export const isTouchable = () => { | |
const userAgent = window.navigator.userAgent; | |
return ( | |
!!userAgent && userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) | |
); | |
}; | |
export const isIphone = () => { | |
return ( | |
!!navigator.platform && |
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
// Zed settings | |
// | |
// For information on how to configure Zed, see the Zed | |
// documentation: https://zed.dev/docs/configuring-zed | |
// | |
// To see all of Zed's default settings without changing your | |
// custom settings, run the `open default settings` command | |
// from the command palette or from `Zed` application menu. | |
{ | |
"features": { |
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
{ | |
"files.autoSave": "onFocusChange", | |
"editor.formatOnSave": true, | |
"workbench.colorTheme": "Gruvbox Dark Medium", | |
"workbench.iconTheme": "gruvbox-material-icon-theme", | |
"editor.fontSize": 16, | |
"terminal.integrated.fontSize": 16, | |
"explorer.confirmDragAndDrop": false, | |
"editor.minimap.enabled": false, | |
"breadcrumbs.enabled": false, |
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
// if you have a javascript object and want to check if it has a key (property) | |
const obj = { | |
"a": 1, | |
"b": 2, | |
"c": 3, | |
} | |
// checking directly from the object might piss off ESLint | |
obj.hasOwnProperty("c"); // 'no-prototype-builtins' error. |
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
function areAdjacent(coord1, coord2) { | |
const [x1, y1] = coord1; | |
const [x2, y2] = coord2; | |
const isHorizontallyAdjacent = Math.abs(x1 - x2) === 1 && y1 === y2; | |
const isVerticallyAdjacent = x1 === x2 && Math.abs(y1 - y2) === 1; | |
const isDiagonallyAdjacent = | |
Math.abs(x1 - x2) === 1 && Math.abs(y1 - y2) === 1; | |
return isHorizontallyAdjacent || isVerticallyAdjacent || isDiagonallyAdjacent; |
NewerOlder