Skip to content

Instantly share code, notes, and snippets.

View acki's full-sized avatar
👋
I may be slow to respond.

Christoph S. Ackermann acki

👋
I may be slow to respond.
View GitHub Profile
@acki
acki / helpers.php
Last active January 20, 2019 18:21
Helper for saving queries when using ACF in WordPress
<?php
// get field function for ACF without using ACF and generating additional queries (normally)
function get( $selector, $post_id = false, $format_value = true ) {
if( function_exists( 'get_post_meta' ) && function_exists( 'acf_get_valid_post_id' ) ) {
$post_id = acf_get_valid_post_id( $post_id );
// Search the data in post meta
@acki
acki / functions.php
Last active November 18, 2020 22:42
Dirty fix for WooCommerce rounding problems due to non-round tax values
<?php
/*
* WooCommerce dirty rounding fix for special tax values (7.7 in Switzerland)
* Rounding to 0.05 instead of 0.01
* created by Christoph S. Ackermann
* https://www.cubetech.ch
* 05.01.2018
*/
@eriteric
eriteric / movegfjstofooter.php
Last active October 13, 2021 16:55
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );

How to not get lost when entering Switzerland

Compiled by the #wcch team for @Rarst ;-)

Arrival at Zurich Airport

You will arrive at Zurich Airport (ZRH) and after you get your luggage and immigration is done, you'll finally be in Switzerland. Congrats and welcome!

The train station aka Zürich Flughafen

Luckily for you, the train station is inside the airport (downstairs). Just follow the signage that looks like this:

Pikto Bahn

@acki
acki / gist:11098108
Last active August 29, 2015 14:00
HTML5 Canvas Heartbeat
<canvas id="canvas" width="150" height="150" style="background-color: black;"></canvas>
<script type="text/javascript">
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#dbbd7a";
ctx.fill();
var fps = 10;
var n = 1;