Skip to content

Instantly share code, notes, and snippets.

View KeviinCosmos's full-sized avatar

Keviin Cosmos KeviinCosmos

View GitHub Profile
@nickknissen
nickknissen / EnOcean PTM 215Z (Friends of Hue) switch.yaml
Created December 9, 2021 07:31
EnOcean PTM 215Z (Friends of Hue) switch
blueprint:
name: Controller - EnOcean PTM 215Z (Friends of Hue) switch
description: 'Controller automation for executing press/hold/release actions triggered by
EnOcean PTM 215Z (Friends of Hue) switch.'
domain: automation
input:
controller_entity:
name: (Zigbee2MQTT) Controller Entity
description: The action sensor of the controller to use for the automation.
@MjHead
MjHead / get-jet-engine-gallery-images.php
Created September 26, 2019 08:37
Example how to get an array of images stored in JetEngine gallery field
@chrismccoy
chrismccoy / gutenberg.txt
Last active November 9, 2024 03:32
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
Filtering Blocks When allowed_block_types_all is a boolean
https://tomjn.com/2024/02/29/filtering-blocks-when-allowed_block_types_all-is-a-boolean/
Gutenberg / Block editor: Dynamically populate SelectControl, RadioControl or CheckboxControl options
https://bdwm.be/gutenberg-block-editor-dynamically-populate-selectcontrol-radiocontrol-or-checkboxcontrol-options/
Gutenberg: custom validation / how to prevent post from being saved
@james2doyle
james2doyle / browser-body-class.php
Last active January 30, 2020 22:01
Add a custom body class to WordPress for the current browser being used. No external frameworks or plugins.
<?php
function custom_body_classes($classes)
{
// the list of WordPress global browser checks
// https://codex.wordpress.org/Global_Variables#Browser_Detection_Booleans
$browsers = ['is_iphone', 'is_chrome', 'is_safari', 'is_NS4', 'is_opera', 'is_macIE', 'is_winIE', 'is_gecko', 'is_lynx', 'is_IE', 'is_edge'];
// check the globals to see if the browser is in there and return a string with the match
$classes[] = join(' ', array_filter($browsers, function ($browser) {
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@stephenharris
stephenharris / copy-pre.css
Last active May 8, 2023 06:46
Adding a 'copy' button to <pre> content
.pre-wrapper{
position:relative;
}
.pre-wrapper pre{
padding-top: 25px;
}
.pre-wrapper .copy-snippet {
border-radius: 0;
min-width:55px;
background: none repeat scroll 0 0 transparent;
@gregrickaby
gregrickaby / remove-woocommerce-styles-scripts.php
Last active October 28, 2024 06:16
Remove WooCommerce styles and scripts.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Manage WooCommerce styles and scripts.
*/
function grd_woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );