Skip to content

Instantly share code, notes, and snippets.

@mpeutz
mpeutz / visualizer CLI
Last active September 3, 2024 22:28
Vite Visualizer
npx vite-bundle-visualizer -c vite.config.mts --emptyOutDir
@mpeutz
mpeutz / FSM.js
Created March 15, 2023 17:08
FiniteStateMachine
// Finite State Machine.
function createMachine(stateMachineDefinition) {
const navigationFsm = {
value: stateMachineDefinition.initialState,
transition(currentState, event) {
const currentStateDefinition = stateMachineDefinition[currentState];
const destinationTransition = currentStateDefinition.transitions[event];
if (!destinationTransition) return navigationFsm.value;
@mpeutz
mpeutz / reset-micro.css
Last active December 16, 2022 17:36
CSS Minimal Reset
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
font: inherit;
@mpeutz
mpeutz / git-launch-ignore
Last active June 6, 2022 18:18
GIt Launch and ignore
git update-index --skip-worktree .vscode/launch.json
git update-index --no-skip-worktree .vscode/launch.json
"runtimeExecutable": "C:/Users/{user}/AppData/Local/Vivaldi/Application/vivaldi.exe"
@mpeutz
mpeutz / local-git-ignore.md
Last active May 13, 2022 19:23
Local Git Ignore
  1. Navigate to .git/info, in the project folder
  2. Open the exclude file in your editor
  3. Put in the files you want to ignore locally (path must be relative to root of project)
  4. Run the following command in the terminal (in your project folder) : git update-index --skip-worktree <path-names>

To bring these files back to being tracked by git (in the case that you need updated configurations from the repository), simply run git update-index --no-skip-worktree .

@mpeutz
mpeutz / ngrok:md
Last active October 7, 2021 21:03
ngrok
ngrok http -host-header="localhost:[port]" [port]
@mpeutz
mpeutz / tabOverflow.css
Last active March 5, 2025 17:56
Tab overflow
.--overflowTab:not(.--jsfied) {
border-bottom: none;
}
.tabs ::-webkit-scrollbar {
width: 4px;
height: 4px;
background-color: var(--color-gray-lightest);
@mpeutz
mpeutz / IO.js
Created September 10, 2021 17:58
Intersection Observer
const myElems = document.querySelectorAll('.c-tab');
observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.intersectionRatio > 0.9) {
console.log('in the view', entry.target);
} else {
console.log('out of view');
}
});
@mpeutz
mpeutz / Batch
Last active July 11, 2025 23:59
C# Snippets
MoreLiq library has to be available.
@foreach(var batch in Model.Items.Batch(2))
{
<ul>
@foreach(var item in batch)
{
<li>@item.Title</li>
}
</ul>
@mpeutz
mpeutz / chrome.css
Last active May 14, 2024 01:03
Scrollbar styles
::-webkit-scrollbar {
width: 10px;
height: 10px;
background: #ddd;
}
::-webkit-scrollbar-thumb {
background: #555;
border-radius: 6px;