Skip to content

Instantly share code, notes, and snippets.

View vielhuber's full-sized avatar
🍐
❹❷

David Vielhuber vielhuber

🍐
❹❷
View GitHub Profile
@vielhuber
vielhuber / _v1.MD
Last active June 30, 2025 09:48
object oriented programming multiple classes as singletons #python

/classes/__init__.py

from .foo import Foo
from .bar import Bar

foo = Foo()
bar = Bar()

# this enables "import *"
__all__ = [
@vielhuber
vielhuber / script.py
Last active June 25, 2025 12:16
object oriented programming classes #python
import random
# ...
class Example:
staticVariable = "baz"
def __init__(self):
@vielhuber
vielhuber / README.MD
Last active June 19, 2025 11:21
chrome extensions #js

tl;dr

  • Neuen Ordner anlegen und Dateien unterhalb erstellen
  • Chrome > Erweiterungen > Entpackte Erweiterung laden > Ordner auswählen
  • Plugin zum schnellen aktualisieren: Extensions Reloader

/manifest.json

{
@vielhuber
vielhuber / README.MD
Last active May 25, 2025 17:18
install xampp on linux mint #server
  • https://www.apachefriends.org/de/index.html
  • chmod 755 xampp-linux-*-installer.run
  • sudo ./xampp-linux-*-installer.run
  • sudo /opt/lampp/lampp start
  • sudo /opt/lampp/lampp stop
  • optional
    • sudo /opt/lampp/manager-linux-x64.run
    • sudo /opt/lampp/lampp restart
  • sudo nano /opt/lampp/etc/php.ini
@vielhuber
vielhuber / script.js
Last active May 16, 2025 11:34
ctrl strg ajax links pushState #js
/* this ensures that ctrl+links open in a new window */
var ctrlPressed = false;
window.addEventListener('keydown', e => {
if (e.metaKey || e.ctrlKey || e.key === 'Control' || e.key === 'Meta') {
ctrlPressed = true;
}
});
window.addEventListener('keyup', e => {
if (e.metaKey || e.ctrlKey || e.key === 'Control' || e.key === 'Meta') {
ctrlPressed = false;
@vielhuber
vielhuber / script.php
Last active May 15, 2025 10:22
foreach unset #php
<?php
/* problem */
$array = ['a' => 1, 'b' => 2, 'c' => 3];
foreach ($array as $array__key => $array__value) {
echo 'iterating over '.$array__key."\n";
if ($array__value === 2) {
unset($array['c']);
}
}
// iterating over a
@vielhuber
vielhuber / README.MD
Created May 14, 2025 14:30
nextcloud setup linux #server
  • sudo mv /etc/apt/preferences.d/nosnap.pref ~/Dokumente/nosnap.backup
  • sudo apt update
  • sudo apt install snapd
  • Terminal neustarten
  • sudo snap install snap-store
  • Linux neustarten
  • Snap Store > NextCloud
  • sudo snap set nextcloud ports.http=8081
  • sudo snap set nextcloud ports.https=8443
  • sudo snap restart nextcloud
@vielhuber
vielhuber / ..MD
Last active May 25, 2025 17:16
reveal.js markdown presentation #js

init

  • mkdir test
  • cd test
  • git clone [email protected]:vielhuber/test.git . # clone empty repository
  • create .gitignore, README.MD, index.html, index.md
  • follow README.MD

start

  • cd test
@vielhuber
vielhuber / style.css
Last active May 14, 2025 07:53
view transition smooth animated site transitions #css
@view-transition {
navigation: auto;
}
@keyframes fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes fade-out {
@vielhuber
vielhuber / style.css
Created May 8, 2025 12:43
100% height on ios hidden elements svh lvh #css
div {
height:100svh; /* fixed, no jumps */
margin-bottom: calc(100lvh - 100svh); /* nice margin below, if nav is hidden */
}