Skip to content

Instantly share code, notes, and snippets.

@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
@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 / AllrasioButtons.html
Created December 21, 2021 21:01
validate radio buttons in form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>JavaScript TestScript 0.1</title>
<style>
form {
margin: auto;
width: 25em;

Grundgesetz für Web Components

§ 1

Web Components sind HTML-Elemente und müssen sich wie HTML-Elemente verhalten. Sie sind kein 1:1-Ersatz für andere Komponenten-Konzepte, sondern universelle, einfach zu benutzende Erweiterungen des HTML-Vokabulars. Ihre Attribute und APIs müssen so konzipiert sein, das sie HTML-Autoren nicht überraschen. Das stellt sicher, dass Web Components universelle Plugins sind, die in jedem Browser und Framework gut funktionieren. Insbesonders zu beachten ist:

§ 1.1

Web Components müssen einen nützlichen Use Case anbieten, der allein mit HTML-Mitteln umgesetzt werden kann. JavaScript-APIs können den Funktionionsumfang einer Web Component beliebig erweitern, dürfen aber nicht zur Pflicht werden (vgl.

§ 1.2

@KoljaL
KoljaL / Svelte+Tailwind.md
Created August 6, 2022 21:14
Install Svelte with Tailwind

Install Svelte

npx degit sveltejs/template svelte-tutorial1
cd svelte-tutorial1
npm install

Install Tailwind

npm install -D tailwindcss postcss autoprefixer svelte-preprocess
npx tailwindcss init tailwind.config.cjs -p
@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 / form-preset-with-grid.markdown
Created October 4, 2022 09:04
form-preset-with-grid
@KoljaL
KoljaL / SvelteKit-FolderBasedRouting.md
Created October 10, 2022 12:35
Routuing in SvelteKit - try to mak a CheatSheet

Routuing in SvelteKit

a CheatSheet

Basics

Folder based routing

  • All routes are inside the folder src/routes/.
  • Every route is a folder: src/routes/about for https://myblog.org/about/.
  • The folders name is the name of the route in the browser.
@KoljaL
KoljaL / index.html
Created October 12, 2022 16:32
Register-Layout
<header>
<div></div>
<div></div>
<div id="theme-switch">
<span id=sun></span>
<span id=moon></span>
</div>
</header>
<main>
@KoljaL
KoljaL / navigation.html
Created October 17, 2022 10:24
My navigation in svelte will not work (isActive()) as a SPA
<script lang="ts">
import { onMount } from 'svelte';
import { base } from '$app/paths';
import { page } from '$app/stores';
// array for register tabs
const ABC = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
// called by every link of tabregister to set it active
$: isActive = (cat: string) => {