Skip to content

Instantly share code, notes, and snippets.

View mountbatt's full-sized avatar

Tobias Battenberg mountbatt

View GitHub Profile
@mountbatt
mountbatt / functions.php
Last active May 17, 2024 11:10
Customize WordPress Elementor Video Widget with GDPR Notice and download YT / Vimeo Thumbnails in /uploads directory for local loading
function add_custom_div_to_elementor_video_widget( $widget_content, $widget ) {
if ( 'video' === $widget->get_name() ) {
$provider = $widget->get_settings('video_type');
$provider_names = [
'youtube' => "YouTube",
'vimeo' => "Vimeo",
];
$gdpr_urls = [
'youtube' => 'https://policies.google.com/privacy?hl=de',
@mountbatt
mountbatt / wetter.js
Last active December 30, 2023 13:37
Scriptable Widget to get Weather Data from a weewx driven Weather-Station via JSON by weewx-json (https://github.com/teeks99/weewx-json). With Shortcodes this Widget is fully Siri compatible!
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: blue; icon-glyph: sun;
// Check weewx Weather
// Script Updates: https://gist.github.com/mountbatt/163c5d8f8bd7978e1f3c06b3dcccf00f
// Version: 0.7.4
// edit:
let endpoint = "http://www.waldbadviertel-wetter.de/current_minimal.json"
let prefix = "im" // im | in | at ... defines "im Waldbadviertel" oder "in Cologne" (set to "in" or "at" for good english)
@mountbatt
mountbatt / inline-portrait.svg.php
Created February 10, 2021 09:48
Use a SVG-shape for images in WordPress
<!-- this is our svg in /images/inline-portrait.svg.php. Make sure the filename ends with *.svg.php -->
<!-- in the "pattern" we create a unique identifier with a sanitized url of the image -->
<!-- this "id" is used as "fill" -->
<svg aria-label="<?php the_title(); ?>" role="img" viewBox="0 0 256 257" version="1.1" class="">
<title><?php the_title(); ?></title>
<defs>
<pattern id="imageID-<?php echo trim(preg_replace('/[^a-z0-9]+/i',"", strtolower(htmlspecialchars_decode($url)))); ?>" width="100%" height="100%" patternUnits="userSpaceOnUse">
<image height="100%" width="100%" x="0" xlink:href="<?php echo $url;?>" y="0"></image>
</pattern>
@mountbatt
mountbatt / ZOE-Widget.js
Last active October 4, 2024 08:16
Scriptable iOS widget that displays the status of your Renault ZOE (or Megane, Dacia Spring) on your iPhone and iPad.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: light-gray; icon-glyph: car;
// version 2024-04-19
// latest changes:
// new kameron api key
// added language strings so you can translate it by yourself!
// add your my-renault account data:
// let myRenaultUser = "user" // email