Skip to content

Instantly share code, notes, and snippets.

View radkill's full-sized avatar
👷‍♂️
Working…

Valerii Bohdanov radkill

👷‍♂️
Working…
View GitHub Profile
@renakdup
renakdup / adminpanel-env-color.php
Last active March 17, 2024 12:53
Adminpanel environment color for WordPress.
<?php
/**
* Adminpanel environment color for WordPress.
* It helps to highlight environments in color. Developers, Content Managers,
* and others will never confuse the environment where they work.
*
* Author: Andrei Pisarevskii
* Author Email: renakdup@gmail.com
* Author Site: https://wp-yoda.com/en/
*
@yunusga
yunusga / wpcf7.js
Created July 5, 2019 06:46
Scroll to first invalid field on Contact Form 7 validation error event
/**
* Scroll to first invalid field
* WPCF7 on validation error event
*/
document.addEventListener( 'wpcf7invalid', function( event ) {
setTimeout( function() {
$('html').stop().animate({
scrollTop: $('.wpcf7-not-valid').eq(0).offset().top - 140,
}, 500, 'swing');
}, 100);
@SilentImp
SilentImp / trashCSSLoader.js
Last active December 4, 2017 07:43
Это сверх-трешевый способ асинхронной загрузки CSS, который Google Page Speed не видит в принципе.
function trashCSSLoader(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function (response) {;
applyCSS(response.target.responseText);
};
xhr.send();
}
function applyCSS(css) {
var styles = document.createElement('style');
@bjorn2404
bjorn2404 / wp_kses_post_tags.php
Last active June 11, 2024 20:31
WordPress allow iFrames with wp_kses_post filter
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param array $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post'.
*
* @return array
*/
@john-doherty
john-doherty / javascript-trim-svg-whitespace.js
Created October 21, 2016 13:39
Trim whitespace from SVG elements
function trimSvgWhitespace() {
// get all SVG objects in the DOM
var svgs = document.getElementsByTagName("svg");
// go through each one and add a viewbox that ensures all children are visible
for (var i=0, l=svgs.length; i<l; i++) {
var svg = svgs[i],
box = svg.getBBox(), // <- get the visual boundary required to view all children
@daggerhart
daggerhart / wordpress-missing-functions.php
Created March 24, 2016 22:19
WordPress functions that I tend to write often
<?php
/**
* Get a WP_Post object by its slug ( post_name )
*
* @param $post_name
*
* @return WP_Post|null
*/
function get_post_by_slug( $post_name ) {
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@ValdikSS
ValdikSS / animetv.md
Last active October 25, 2020 18:09
AnimeTV

Коллективные просмотры аниме и мультиков.

Информация

Мы — компания людей, людящих смотреть аниме в компании и обсуждать его после просмотра. Чтобы присоединиться, заходите в любую из наших конференций:
XMPP / Telegram
Общайтесь и делитесь впечатлениями от просмотренного.

Коллективные просмотры анонсируются в Mastodon, в RSS-потоке, а также в конференциях.

Подключение к просмотру

<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.1
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2
@cferdinandi
cferdinandi / stop-video.js
Last active June 6, 2024 13:57
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;