Skip to content

Instantly share code, notes, and snippets.

View Mon4ik's full-sized avatar
:shipit:

Дмитрий Mon4ik

:shipit:
View GitHub Profile
@Mon4ik
Mon4ik / useLocalStorage.ts
Last active May 26, 2024 06:23
Typescript useLocalStorage hook
/* `useLocalStorage`
*
* Features:
* - JSON Serializing
* - Also value will be updated everywhere, when value updated (via `storage` event)
*/
import { useEffect, useState } from "react";
export default function useLocalStorage<T>(key: string, defaultValue: T): [T, (value: T) => void] {
@kocisov
kocisov / next_nginx.md
Last active June 10, 2024 19:45
How to setup next.js app on nginx with letsencrypt
@deiu
deiu / webcryptoapi.html
Last active June 27, 2024 07:44
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})