Skip to content

Instantly share code, notes, and snippets.

function isIE() {
var value = false;
if (window.navigator.userAgent.indexOf('Trident/') > 0) {
value = true;
}
return value;
}
if (isIE() !== true){
$('.ie-browser-connected').remove();
/**
* @param string $url
* @return string|string[]
*/
function force_relative_url(string $url)
{
return str_replace(get_site_url(), '', $url);
}
/**
function removeDuplicates(myArr, prop) {
return myArr.filter((obj, pos, arr) => {
return arr.map(mapObj => mapObj[prop]).indexOf(obj[prop]) === pos;
});
}
/**
* @param WP_Post $post
* @return string|null
*/
function getPictureTyre(\WP_Post $post): ?string
{
$result = null;
$pathToImg = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'Large size')[0];
if ($pathToImg !== null) {
$result = '<img src="' . $pathToImg . '" class="tyre-post-thumbnail" >';
<?php
/**
* @param string $pathToImg
* @return string
*/
function toBase64(string $pathToFile): string
{
$type = pathinfo($pathToFile, PATHINFO_EXTENSION);
$data = file_get_contents($pathToFile);
return 'data:image/' . $type . ';base64,' . base64_encode($data);
$this->addSql(
"UPDATE matable SET slug =
concat(
lower(
replace(
replace(
replace(
replace(
replace(
replace(
/** Force number in input field of Organisator phone number */
let textarea = document.getElementById('event_form_author_phone');
textarea.addEventListener('keydown', (e) => {
console.log(e.key);
if (['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'Backspace'].indexOf(e.key) === -1) {
e.preventDefault();
}
});
// ==UserScript==
// @name Who has talked?
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show a list of attendees to see who has already talked. Click on a name to remove it. Double click on the list to remove the overlay.
// @author You
// @match https://meet.google.com/*
// @grant none
// ==/UserScript==