Skip to content

Instantly share code, notes, and snippets.

@codemile
codemile / useDraggable.tsx
Created July 6, 2021 12:21
Hook that makes a DOM element draggable.
import {
MouseEventHandler,
RefObject,
useCallback,
useEffect,
useRef,
useState
} from 'react';
export type DraggableHandler = (coords: [number, number]) => void;
@awestbro
awestbro / index.html
Created April 19, 2020 14:54
Highlighting margin, border, and padding with Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Highlighting elements example</title>
</head>
<body>
@satwikkansal
satwikkansal / cheatsheet.cpp
Last active December 25, 2024 23:50
C++ STL cheatsheet for competitive progrmming
/*
This a header file that includes every standard library.
You can use it to save time.
NOTE: This header file may not be recognized by compilers
other than gcc.
*/
#include <bits/stdc++.h>
/*
//Use this if the above header file doesn't work.