Skip to content

Instantly share code, notes, and snippets.

Geek-mode Initialized

Daan van den Bergh Dan0sz

Geek-mode Initialized
Block or report user

Report or block Dan0sz

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
Dan0sz / caos-google-optimize.php
Created Dec 2, 2019
Add Google Optimize to CAOS
View caos-google-optimize.php
* @formatter:off
* Plugin Name: Google Optimize for CAOS
* Plugin URI:
* Description: Add Google Optimize for CAOS in gtag.js
* Version: 1.0.0
* Author: Daan van den Bergh
* Author URI:
* License: GPL2v2 or later
Dan0sz / class-wp-proxy.php
Created Sep 18, 2019
A WordPress REST Controller to pass-thru Google Analytics Data
View class-wp-proxy.php
* @author : Daan van den Bergh
* @url :
* @copyright: (c) 2019 Daan van den Bergh
* @license : GPL2v2 or later
class Analytics_Proxy extends WP_REST_Controller
Dan0sz / functions.php
Last active Apr 30, 2019
Remove Google Fonts from Sparkling WordPress Theme using a Child Theme
View functions.php
// The start of my Child Theme's functions.php
function sparkling_remove_google_fonts() {
add_action('wp_enqueue_scripts', 'sparkling_remove_google_fonts', 100);
Dan0sz / edited-wp-config.php
Last active Mar 10, 2019
An example wp-config.php
View edited-wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'new_db_name' ); # CHANGE THIS!
/** MySQL database username */
define( 'DB_USER', 'existing_db_username' );
/** MySQL database password */
define( 'DB_PASSWORD', 'existing_db_password' );
Dan0sz / find-replace.sql
Last active Mar 10, 2019
MySQL find and replace query
View find-replace.sql
UPDATE `table_name`
SET `column_name` = replace(column_name, '', '')
Dan0sz /
Last active Mar 10, 2019
301 Redirect to new domain including Request URI
RewriteEngine on
# Exception for Google Verification
RewriteCond %{REQUEST_URI} !^/google-verification-file.html
# Exception Let's Encrypt Challenge
RewriteCond %{REQUEST_URI} !^/.well-known/
# 301 Redirect to New Domain incl. Request URI
RewriteRule ^(.*)$$1 [R=301,L]
Dan0sz / host-anything-locally.php
Last active Aug 30, 2019
Script to host any javascript file locally, which can be scheduled using Crontab
View host-anything-locally.php
// Script to update any js-file
// Credits go to: Matthew Horne
// Remote file to download
$remoteFile = '';
$localFile = '/path/to/your/webroot/analytics.js';
// Check if directory exists, otherwise create it.
$uploadDir = '/path/to/your/webroot/';
Dan0sz / Model\Custom.php
Last active Feb 4, 2019
How to Format Prices using the Price Currency Interface in Magento 2
View Model\Custom.php
namespace Daan\CustomModule\Model; // Or Controller, or Plugin, or anything actually.
use Magento\Framework\Pricing\PriceCurrencyInterface as CurrencyInterface;
class Custom {
protected $currencyInterface;
Dan0sz /
Created Oct 21, 2018
Install Python 2.7.x from Source with sqlite3 included
# Prerequisites for Python 2.7.x
apt-get update
apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
# Download and extract Python 2.7.13
cd /usr/src
curl -O
tar xvfz Python-2.7.13.tgz
Dan0sz / total-price-of-cart.php
Created Oct 21, 2018
Get Total Price of Cart Including/Excluding VAT/Tax in Magento Minicart Widget
View total-price-of-cart.php
// Get Price of all including VAT/Tax
// Get Total Price excluding/without VAT/Tax
You can’t perform that action at this time.