Skip to content

Instantly share code, notes, and snippets.

View PiotrKrzyzek's full-sized avatar

Peter Krzyzek PiotrKrzyzek

View GitHub Profile
@PiotrKrzyzek
PiotrKrzyzek / tuya_4gang_zha_blueprint.yaml
Last active April 28, 2024 19:22
Home Assistant Blueprint For Tuya 4-gang Zigbee Integration via ZHA
blueprint:
name: ZHA - Tuya 4-Button Scene Switch
description: Automate your Tuya 4-Button Scene Switch via ZHA.
domain: automation
input:
switch:
name: Tuya Zigbee Switch
description: Tuya 4-Button Scene Switch to use
selector:
device:
<?php
/**
* WP USER LIST
*/
add_filter('fluenform_rendering_field_data_select', function ($data, $form) {
if ($form->id != 7) {
return $data;
}
@zackpyle
zackpyle / *Best Snippets*
Last active May 1, 2024 20:05
Best PHP/JS Snippets
This is a collection of my most used or most useful PHP and JS snippets
**Disclaimer, I didn't write most of these - I just curated them over the years**
@manchumahara
manchumahara / gist:388e64886fe34c280e909346c763bc03
Created December 30, 2019 12:38
display order status list in my orders in woocommerce https://codeboxr/.com
add_action( 'woocommerce_before_account_orders', 'woo_my_orders_display_status' );
function woo_my_orders_display_status( $has_orders = false ) {
//if($has_orders){
$post_status = isset( $_REQUEST['post_status'] ) ? sanitize_text_field( $_REQUEST['post_status'] ) : 'all';
$order_page_url = get_permalink( wc_get_page_id( 'orders' ) );
echo '<div class="clear clearfix"></div>';
@ekwoster
ekwoster / jquery.classChanged.event.js
Created June 29, 2017 09:43
jQuery Class Changed Event
(function(){
var originalAddClassMethod = jQuery.fn.addClass;
var originalRemoveClassMethod = jQuery.fn.removeClass;
jQuery.fn.addClass = function(){
var result = originalAddClassMethod.apply( this, arguments );
jQuery(this).trigger('classChanged');
return result;
}
jQuery.fn.removeClass = function(){
var result = originalRemoveClassMethod.apply( this, arguments );
@vishalkakadiya
vishalkakadiya / manage_columns_wp_admin.php
Last active March 16, 2024 01:08
Manage custom columns with sortable in WordPress Admin side
<?php
/*
* =================================================================================================
* Below both hooks works for custom post types.
* e.g. Suppose we have custom post-type name : Books
* @ref https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column
* =================================================================================================
*/
@danielmcclure
danielmcclure / facebook-wca-standard-events.html
Last active January 14, 2024 14:54
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
@morganestes
morganestes / WordPress get_the_ID() replacement.md
Last active May 16, 2021 21:15
Get the WordPress post ID no matter where you are.

This extends the built-in WordPress function get_the_ID() to return the post ID both inside and outside the loop.

Used outside the loop (in header.php):

<?php if ( function_exists( 'gt_hide_nav' ) && ! gt_hide_nav() ) : ?>
  <nav role="navigation">
    <?php if ( function_exists( 'bones_main_nav' ) ) bones_main_nav(); ?>
  </nav>
@eligrey
eligrey / insertAdjacentHTML.js
Created October 10, 2011 18:06
insertAdjacentHTML polyfill
/*
* insertAdjacentHTML.js
* Cross-browser full HTMLElement.insertAdjacentHTML implementation.
*
* 2011-10-10
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/