Skip to content

Instantly share code, notes, and snippets.

Jan Beck jancbeck

  • Germany
Block or report user

Report or block jancbeck

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
git clone --bare $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
echo "Checked out config.";
echo "Backing up pre-existing dot files.";
jancbeck /
Last active Jul 31, 2019
Setup Uberspace 7
# switch to zsh shell
chsh --shell /bin/zsh
# install oh-my-zsh
sh -c "$(curl -fsSL"
# remove existing .zshrc
rm -rf .zshrc
jancbeck / wp-role-bodyclass.php
Last active Feb 14, 2019
WordPress: Add user role class to body tag
View wp-role-bodyclass.php
// Add role class to body
function add_role_to_body($classes) {
global $current_user;
$user_role = array_shift($current_user->roles);
$classes .= 'role-'. $user_role;
return $classes;
jancbeck / redis.php
Created Oct 2, 2015
Redis Cache for Kirby. Requires Predis.
View redis.php
namespace Cache\Driver;
use Cache\Driver;
* Redis
* @package Kirby Redis
jancbeck / package.json
Created May 10, 2018
Dynamically search and replace server logs when they change. Uses gulp.js and node
View package.json
"name": "process-log",
"version": "1.0.0",
"description": "Dynamically search and replace server logs when they change",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"keywords": [
jancbeck / functions.php
Created Apr 8, 2017
Uses the "New Customer" email template by WooCommerce when a new user is created via the WP Job Manager. Add to your themes functions.php
View functions.php
function wp_job_manager_notify_new_user( $user_id, $password ){
global $wp_version;
$wc_emails = WC_Emails::instance();
if ( empty($wc_emails)) {
jancbeck / password-protect.php
Created Sep 27, 2016
Automatically password protect all new custom post types in WordPress
View password-protect.php
add_filter( 'wp_insert_post_data', function( $data, $postarr ){
if ( 'book' == $data['post_type'] && 'auto-draft' == $data['post_status'] ) {
$data['post_password'] = wp_generate_password();
return $data;
}, '99', 2 );
jancbeck /
Last active Feb 2, 2017
Documenting the process of setting up my local environment for web design and development (OS X 10.9 Mavericks)

User Home Directory

Restore home folder from backup. You better have a backup.

Important files and folders:

  • ~/.bash_profile
  • ~/.ssh/
  • ~/Library/Preferences/

Keybase proof

I hereby claim:

  • I am jancbeck on github.
  • I am jancbeck ( on keybase.
  • I have a public key ASBC8CHbwPT11Jz5cP_InKjVuD8YZTxpWsJGqPTkiBWy6go

To claim this, I am signing this object:

jancbeck / woocommerce-optimize-scripts.php
Last active Jun 8, 2016 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
View woocommerce-optimize-scripts.php
<?php add_action( 'wp_enqueue_scripts', function() {
if ( function_exists( 'is_woocommerce' ) && ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
wp_dequeue_style( 'woocommerce_frontend_styles' );
wp_dequeue_style( 'woocommerce_fancybox_styles' );
wp_dequeue_style( 'woocommerce_chosen_styles' );
wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
wp_dequeue_script( 'wc_price_slider' );
wp_dequeue_script( 'wc-single-product' );
wp_dequeue_script( 'wc-add-to-cart' );
You can’t perform that action at this time.