Skip to content

Instantly share code, notes, and snippets.

View fostyfost's full-sized avatar
🤪
All you need is Half-Life 3

Fosty Fost fostyfost

🤪
All you need is Half-Life 3
View GitHub Profile
import {useEffect} from 'react';
type EventKey = string;
type EventHandler<T = any> = (payload: T) => void;
type EventMap = Record<EventKey, EventHandler>;
type Bus<E> = Record<keyof E, E[keyof E][]>;
interface EventBus<T extends EventMap> {
on<Key extends keyof T>(key: Key, handler: T[Key]): () => void;
off<Key extends keyof T>(key: Key, handler: T[Key]): void;
@rajkosto
rajkosto / gist:fbfa22a3c6d6bff7d9ebf92ec8adeb34
Last active April 9, 2025 12:44
Yettel Hipernet ZTE ZXHN H298Q detalji, i tutorial za izvlacenje podataka iz config fajla
ZTE Yettel ruter uspostavlja sledece veze preko svog WAN kabla:
Connection: Management
DHCP IPoE VLAN 715 Priority 0
Vendor class dslforum.org
IP address 10.48.x.x/255.254.0.0
Ovu mrezu koristi da komunicira sa TR069 ACS-om na adresi https://acs.cetin.rs:10302/acs/serbia
Connection: Voice
DHCP IPoE VLAN 711 Priority 5
@getify
getify / 1-setup.js
Last active November 8, 2024 18:36
find size of largest region in matrix... solutions are breadth-first iterative (2) and depth-first recursive (3)
// Adapted from: https://www.geeksforgeeks.org/find-length-largest-region-boolean-matrix/
"use strict";
var M1 = [
[ 0, 0, 1, 1, 0 ],
[ 1, 0, 1, 1, 0 ],
[ 0, 1, 0, 0, 0 ],
[ 0, 0, 0, 1, 1 ]
];
@EllyLoel
EllyLoel / reset.css
Last active January 24, 2025 09:14
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@FbN
FbN / vite.config.js
Last active April 6, 2025 13:31
vite.config.js node built-in polyfills
// yarn add --dev @esbuild-plugins/node-globals-polyfill
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
// yarn add --dev @esbuild-plugins/node-modules-polyfill
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'
export default {
resolve: {
alias: {
@sindresorhus
sindresorhus / esm-package.md
Last active April 19, 2025 18:24
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ifyoumakeit
ifyoumakeit / github-conventional-comments.js
Last active February 8, 2025 19:19
GitHub Conventional Comments (instructions to install in comment below code)
(async function generateReplies(document) {
// https://conventionalcomments.org/#labels
const LABEL = {
praise: "praise",
nitpick: "nitpick",
suggestion: "suggestion",
issue: "issue",
todo: "todo",
question: "question",
thought: "thought",
@lokhmakov
lokhmakov / index.js
Last active October 25, 2022 08:37
effector - run effect once through event
const runQuery = createEffect({
handler(props) {
console.log(props)
},
})
const createOnceEvent = to => {
const from = createEvent()
const unsubscribe = forward({from, to})
from.watch(unsubscribe)
@borisovonline
borisovonline / debian-personalvpn.md
Last active April 16, 2025 15:03
Create a personal VPN server based on Linux Debian and strongSwan

Tutorial: how to create a personal VPN server based on Linux Debian, strongSwan, certificates authentification and ready to use .mobileconfig profiles to use on iPhone, iPad and Mac

This is a part of a big article I posted on Medium. Here is only a tutorial.

We're going to create a personal VPN server, using the following technologies:

  • IKEv2 as a VPN protocol
  • Linux Debian as a server OS
  • strongSwan as a VPN server
  • Certificates as an authentication method

You can use this tutorial on any hosting you prefer.

@herr-vogel
herr-vogel / material-ui-next-js-button.js
Last active November 16, 2021 10:14
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>