This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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: [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Target state | |
var tx = 0; | |
var ty = 0; | |
var scale = 1; | |
function visualiseTargetState() { | |
box.style.transform = `translate(${tx}px, ${ty}px) scale(${scale})`; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "SofleKeyboard", | |
"author": "Josef Adamcik", | |
"switchMount": "cherry" | |
}, | |
[ | |
{ | |
"y": 0.2, | |
"x": 3, |
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 = { |
No Javascript required. Just plain CSS.
A Pen by Yago Estévez on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) { |
NewerOlder