Skip to content

Instantly share code, notes, and snippets.

View Mon4ik's full-sized avatar
:shipit:

Dmitry Mon4ik

:shipit:
View GitHub Profile
@deiu
deiu / webcryptoapi.html
Last active November 18, 2024 01:55
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)
})
@kocisov
kocisov / next_nginx.md
Last active August 2, 2024 13:02
How to setup next.js app on nginx with letsencrypt
@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] {
@littensy
littensy / background-blur.tsx
Created June 29, 2023 03:38
A bunch of components I like to use often
import { useBindingListener, useCamera } from "@rbxts/pretty-roact-hooks";
import Roact from "@rbxts/roact";
import { useState } from "@rbxts/roact-hooked";
interface BackgroundBlurProps {
blurSize?: number | Roact.Binding<number>;
}
/**
* Wraps a BlurEffect
@dgalling
dgalling / add.c
Created September 8, 2024 18:09
Simple C interop example in swift
int add(int a, int b) {
return a + b;
}