Skip to content

Instantly share code, notes, and snippets.

@KoljaL
KoljaL / nextcloud-menu.css
Created April 21, 2025 07:59
little hack for an old nextcloud
#appmenu:hover li svg, #appmenu:hover li .icon-more, #appmenu:hover li .icon-more-white, #appmenu:hover li .icon-loading-small, #appmenu:hover li .icon-loading-small-dark {
transform: translateY(7px);
}
#appmenu:hover li span {
opacity: 0.6;
top: 2px;
z-index: -1;
}
#appmenu li {
(function () {
'use strict';
function categorizeAndRankColorsWithRanksOnWebsite() {
const isExcludedElement = (element) => element.tagName !== 'STYLE' && element.tagName !== 'SCRIPT';
const allElements = Array.from(document.body.getElementsByTagName('*')).filter(isExcludedElement);
const colorCategories = {
font: [],
@KoljaL
KoljaL / pan-zoom-touch-and-trackpad.js
Created January 14, 2025 13:04 — forked from Martin-Pitt/pan-zoom-touch-and-trackpad.js
Panning and Pinch-Zoom gesture handler for both touchscreens and trackpads; Works really well on a MacBook trackpad
// Target state
var tx = 0;
var ty = 0;
var scale = 1;
function visualiseTargetState() {
box.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`;
}
[
{
"name": "SofleKeyboard",
"author": "Josef Adamcik",
"switchMount": "cherry"
},
[
{
"y": 0.2,
"x": 3,
@KoljaL
KoljaL / comparison-between-methods-of-applying-the-goo-filter.markdown
Created February 26, 2024 17:12
comparison between methods of applying the goo filter
@KoljaL
KoljaL / Roles_in_Laravel.md
Created October 26, 2023 15:42
Multiple User groups in Laravel

For my Laravel App, I need two types of Users: Staff & Member. Some Staff-User has an "is_admin" flag for more rights.

My first attempt was to create two new User-like Models. But as I found out, and it was recommended to me, that is not the common way.

So now I use the User-Model only for the Login (email, name, password & role) and to divide the User-Types by a role field. That worked very well for the login procedure.
But if it's necessary to edit some fields of one of the User-Type, it is getting complicated, because there are always two Models to handle.
This is my code to create a new Member, for example:

// Shows all font and background colors on an table,
// use with Greasemonkes or as a browser bookmark
(function () {
'use strict';
function categorizeAndRankColorsWithRanksOnWebsite() {
// let allElements = document.getElementsByTagName('*');
const allElements = Array.from(document.body.getElementsByTagName('*')).filter((element) => element.tagName !== 'STYLE' && element.tagName !== 'SCRIPT');
// console.log('allElements', allElements);
const colorCategories = {
@KoljaL
KoljaL / tools.md
Last active August 10, 2023 12:26

Führungsschiene

Idealo 40€

Akku 10,8V

Amazon 37€
oder
Idealo 30€

Stichsäge DJV185

@KoljaL
KoljaL / css-only-parallax-effect.markdown
Created July 2, 2023 08:20
CSS-Only Parallax Effect
@KoljaL
KoljaL / util.js
Created June 6, 2023 07:16
Collected functions for util.js
// return *positive* remainder of n divided by m.
export function mod(n, m) {
return ((n % m) + m) % m;
}
export function sleep(time) {
return new Promise((res) => setTimeout(res, time));
}
function randInt(a, b) {