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
@getify
getify / 1-setup.js
Last active December 15, 2023 13:25
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 April 13, 2024 18: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/open-props@1.3.16/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 18, 2024 08:36
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 May 8, 2024 10:22
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 May 6, 2024 14:31
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 March 2, 2024 23:27
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>
@timruffles
timruffles / next.md
Last active February 23, 2024 17:04
Next.js page request handling

How Next.js responds to a page request with HTML

We create the next request handler function via app.getRequestHandler(). This returns a standard express handler, so we use it like expressApp.get('*', middlewareA(), middlewareB(), nextApp.getRequestHandler()).

When the handler is invoked:

  • Server#handleRequest (next-server/server/lib/next-server.js)
    • Parses URL + query string if not already done
  • Server#run
  • Searches for matching route
@didi0613
didi0613 / shorten-css-classname.md
Last active March 22, 2021 08:46
Shorten css class names for css module

Shorten css class names for css module

Jira Ticket

https://jira.walmart.com/browse/CEECORE-255

Background

Electrode Application can use css-modules as one of the style options, CSS names can get long with local identifier name and random hash.