Skip to content

Instantly share code, notes, and snippets.

@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 / 55-bytes-of-css.md
Created September 29, 2022 19:56 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@KoljaL
KoljaL / next_prev_post.php
Created October 21, 2021 02:17 — forked from rveitch/next_prev_post.php
Get next and prev posts in Wordpress by alphabetical order.
<?PHP
/*
* Sort Next/Previous Post Link Buttons Alphabetically
*/
function filter_next_post_sort($sort) {
if (get_post_type($post) == 'portfolio_page') {
$sort = "ORDER BY p.post_title ASC LIMIT 1";
}
else{
$sort = "ORDER BY p.post_date ASC LIMIT 1";
@KoljaL
KoljaL / php-comments-trick.php
Last active December 21, 2021 21:11 — forked from mircobabini/php-comments-trick.php
PHP comment trick
<?php
//* remove the first slash to toggle the enabled code
$time = microtime( true );
/*/
$time = microtime();
/**/
// thanks @lamemind