Skip to content

Instantly share code, notes, and snippets.

@Luckyfella73
Luckyfella73 / leaflet-map.js
Created March 28, 2023 14:47
Leaflet map - removed leaflet link
import 'leaflet/dist/leaflet.css';
import L from 'leaflet';
const baseUrl = window.location.origin;
const accessToken =
'<-- insert access token here -->';
const selectorMap = '.c-map';
const initMap = () => {
@Luckyfella73
Luckyfella73 / yinfo.php
Last active November 23, 2022 07:57
Saver use of phpinfo()
<?php
# DateTime when forced exit is due:
$mbtk_time_to_stop = new DateTime("2022-11-23 17:00:00");
# DateTime now:
$mbtk_date_time_now = new DateTime();
if($mbtk_time_to_stop < $mbtk_date_time_now) {
exit('silence is golden :/ - set working time');
}
@Luckyfella73
Luckyfella73 / webp-detect.js
Last active July 22, 2021 11:46
WebP detect and WebP background-image with fallback
const dataAttributeWebPCheck = 'data-webp-support-flag';
const selectorWebPCheck = `[${dataAttributeWebPCheck}]`;
const classnameHasSupport = 'webp-supported';
const classnameHasNoSupport = 'webp-not-supported';
let elements = null;
let hasWebPSupport = false;
async function supportsWebp() {
if (!window.createImageBitmap) return false;
const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=';
@Luckyfella73
Luckyfella73 / info.php
Created March 30, 2021 15:59
Secure phpinfo by setting "datetime-range" for allowed functionality
<?php
# DateTime when forced exit is due:
$datetime_to_stop = new DateTime("2021-03-30 17:00:00");
# DateTime now:
$datetime_now = new DateTime();
if($datetime_to_stop < $datetime_now) {
exit('silence is golden :/ - set working time');
}
@Luckyfella73
Luckyfella73 / swiper-slider-bullet-points-circle.scss
Created July 14, 2020 09:48
Swiper slider bullet point circle
// set in config file when using
$swiper-bullet-point-color: #ffffff;
$swiper-bullet-point-size: 13px;
$swiper-bullet-point-border-width: 2px;
.swiper-pagination-bullet {
display: inline-block;
width: $swiper-bullet-point-size;
height: $swiper-bullet-point-size;
background-color: transparent;
@Luckyfella73
Luckyfella73 / twig-function-wpml-get-translation-url-by-langcode.php
Last active December 7, 2019 00:44
Timber Twig function - WPML - get translation url by passing langcode
<?php
function add_twig_function() {
function get_translation_url_by_langcode($target_langcode) {
// docs: https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
if ( function_exists('icl_get_languages') ) {
$langlist = icl_get_languages();
$url = '';
foreach ($langlist as $item) {