Skip to content

Instantly share code, notes, and snippets.

View vielhuber's full-sized avatar
🍐
❹❷

David Vielhuber vielhuber

🍐
❹❷
View GitHub Profile
@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 */
}
@vielhuber
vielhuber / script.php
Created May 6, 2025 16:28
lock files prevent multiple duplicate script execution #php
<?php
$lock = fopen(sys_get_temp_dir() . '/' . md5(__FILE__) . '.lock', 'c');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
echo 'current script already running...';
die();
}
echo 'script running...';
sleep(10);
@vielhuber
vielhuber / README.MD
Last active May 29, 2025 09:45
basics #python

virtual environments

setup

  • python -m venv venv
  • pip install ...

activate

  • source venv/bin/activate

deactivate

@vielhuber
vielhuber / script.php
Created April 4, 2025 10:47
WP_REST_Response response immediately from inner function and die #wordpress
<?php
final class Test {
public function init() {
register_rest_route('v1', '/...', [
/* ... */
'callback' => function () {
// basic way
return new \WP_REST_Response([], 200);
// usage in inner functions
$this->fun1();