Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Leho Kraav lkraav

🎯
Focusing
Block or report user

Report or block lkraav

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lkraav
lkraav / pods-act-data-save.php
Last active Feb 14, 2019
Working with Pods - Advanced Content Types, data save example https://www.meetup.com/Tallinn-WordPress-meetup/events/257955635/
View pods-act-data-save.php
try {
$counts = $client->counts->getCounts( [] );
if ( isset( $counts->type ) && 'count.hash' === $counts->type ) {
$pod_name = 'metric';
$pod = pods(
$pod_name,
View embedded-managed-wpv_template.diff
diff --git a/embedded/inc/views-templates/wpv-template.class.php b/embedded/inc/views-templates/wpv-template.class.php
index 62586ce..52c2ea4 100644
--- a/embedded/inc/views-templates/wpv-template.class.php
View gh12929-wc-2.6.10-add-to-cart-variation-custom-dimension-compatibility.js
<script>
(function( $, window, document, undefined ) {
/**
* `VariationForm.update_variation_values` can only differentiate
* variations by `value` attributes. Our secondary dimension is
* `data-variation-id`. Memoize original selection here.
*
* @see {@link https://github.com/woocommerce/woocommerce/blob/2.6.14/assets/js/frontend/add-to-cart-variation.js}
* @see {@link https://github.com/woocommerce/woocommerce/issues/12929}
View hybrid-locate-template.php
<?php
/*
Plugin Name: Hybrid Core hybrid_locate_template()
Plugin URI: https://github.com/justintadlock/hybrid-core/issues/111
Description: Free yourself from TEMPLATEPATH and STYLESHEETPATH constants
Author: Leho Kraav
Author URI: http://conversionready.com
Version: 2015.06.10
License: MIT
*/
View optimizely+ga-classic+hotjar
(function(){
// @version 2016.03.11
var experimentID = COPY_PASTE_ID_FROM_URL;
window.optimizely = window.optimizely || [];
// avoid firing in editor
if (window.optimizely.activeExperiments.indexOf(experimentID.toString()) == -1) return;
if (typeof window.optimizely.data.experiments[experimentID] !== 'undefined') {
View optimizely+ga-universal+hotjar
(function(){
// @version 2016.03.11
var experimentID = COPY_PASTE_ID_FROM_URL;
window.optimizely = window.optimizely || [];
// avoid firing in editor
if (window.optimizely.activeExperiments.indexOf(experimentID.toString()) == -1) return;
if (typeof window.optimizely.data.experiments[experimentID] !== 'undefined') {
View gw-gravity-forms-minimum-characters.php
<?php
/**
* Gravity Wiz // Require Minimum Character Limit for Gravity Forms
*
* Adds support for requiring a minimum number of characters for text-based Gravity Form fields.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
View plugin.php
<?php
/*
Plugin Name: Toolbar Theme Switcher - LESS CSS Integration
Plugin URI: https://github.com/sanchothefat/wp-less/issues/43
Description: Fix cache refresh when switching themes
Author: Leho Kraav
Author URI: http://leho.kraav.com
Version: 1.0
License: MIT
*/
View gf-preview.php
<?php
function gf_populate_confirmation_preview_html( $form ) {
$confirmation_slug = "Kinnitamine"; # content target HTML field has to have this name
$current_page = GFFormDisplay::get_current_page( $form[ "id" ] );
$output_field = false;
$has_product_fields = false;
# http://www.gravityhelp.com/forums/topic/gform_post_paging-parameters-dont-match-form-pagination-pages-why
if ( in_array( $confirmation_slug, $form[ "pagination" ][ "pages" ] ) && $form[ "pagination" ][ "pages" ][ $current_page - 1 ] == $confirmation_slug ) :
foreach( $form[ "fields" ] as &$field ) :
@lkraav
lkraav / samsung-status.sh
Created Feb 5, 2012
Hourly reminder on how awesome your Samsung Series 9 is doing
View samsung-status.sh
#!/bin/bash
SYSPATH="/sys/devices/platform/samsung"
SUMMARY="Samsung Status"
BODY=()
BODY+=("performance_level: $(cat "$SYSPATH/performance_level")")
BODY+=("backlight: $(cat "/sys/class/backlight/acpi_video0/brightness") / $(cat "/sys/class/backlight/acpi_video0/max_brightness")")
BODY+=("kbd_backlight: $(cat "$SYSPATH/leds/samsung::kbd_backlight/brightness") / $(cat "$SYSPATH/leds/samsung::kbd_backlight/max_brightness")")
BODY+=("$(cat "$SYSPATH/rfkill/rfkill0/name"): $(cat "$SYSPATH/rfkill/rfkill0/state")")
BODY+=("$(cat "$SYSPATH/rfkill/rfkill1/name"): $(cat "$SYSPATH/rfkill/rfkill1/state")")
You can’t perform that action at this time.