Skip to content

Instantly share code, notes, and snippets.

View MattterSteege's full-sized avatar
😄
Always happy

Kronk MattterSteege

😄
Always happy
  • Netherlands
View GitHub Profile
.months .month {
--rows: 5;
--row-lines: 4;
--row-step: 20%;
--col-lines: 6;
--col-step: 14.28%;
--line-color: #000;
display: grid;
@MattterSteege
MattterSteege / TabGroupComponent.js
Created January 7, 2025 19:03
Two new html elements (<tab-group> and <tab-element>) which adds an automatic tab system into your project
/**
Copyright 2025 Matt ter Steege
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@MattterSteege
MattterSteege / ContextMenu.js
Created December 12, 2024 18:08
A small system that helps to add context menu's to your web-app
class ContextMenu {
#container;
#menuDom = null;
#isVisible = false;
#isRootMenu = true;
#parentMenu = null;
#childMenus = [];
#menuItems;
constructor(container, items) {
@MattterSteege
MattterSteege / KeyboardShortcuts.js
Created December 12, 2024 18:07
A small system to easily add shortcuts to your web-app
class KeyboardShortcuts {
/**
* Initializes the KeyboardShortcuts instance and binds the event listener.
*
* @example
* const shortcuts = new KeyboardShortcuts();
* shortcuts.addShortcut('ctrl+s', event => console.log('Save'));
* shortcuts.addShortcut('ctrl+z', event => console.log('Undo'));
* shortcuts.addShortcut('ctrl+y', event => console.log('Redo'));
*
@MattterSteege
MattterSteege / example.js
Last active February 5, 2025 15:47
turn a JSON object into a collapsable html element
const jsonData = {
items: [
{ Title: "test", SubTitle: "", Image: "" },
{ Title: "", SubTitle: "subtitle", Image: "https://example.com/image" }
],
nested: {
hint: "Think about what you use to type.",
moreHints: {
hint1: "You have 26 letters.",
hint2: "It's essential for computers."
@MattterSteege
MattterSteege / overlay.html
Created December 25, 2023 12:36
a crude mask system for highlighting a certain part of an screen
<div id="overlay">
<div class="left" style="left: 0"></div>
<div class="right" style="right: 0"></div>
<div class="top" style="top: 0"></div>
<div class="bottom" style="bottom: 0"></div>
<div class="corners"></div>
</div>
@MattterSteege
MattterSteege / CF_CORS_proxy.js
Created July 19, 2023 06:16
Een copy-paste cors proxy voor cloudflare workers
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
const apiUrl = url.searchParams.get('url')
if (!apiUrl) {
return new Response('Missing URL parameter', { status: 400 })