Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / cpt-bootstrap-carousel.php
Last active November 15, 2015 12:02 — forked from jdcauley/carousel.php
Custom Post Type Slider to slide products, features and so on including the template for the custom post bootstrap slider as well as minimum needed CSS. This Custom Post Type Boostrap Slider has been forked from JDCauley's slider, adjusted and styled using http://goo.gl/Vd1ScP . #wordpress #bootstrap #wordpress
@jasperf
jasperf / functions.php
Created November 27, 2015 06:47 — forked from sunriseweb/functions.php
Makes Divi Pagebuilder work with Yoast SEO
//Enable shortcodes in WordPress SEO generated Meta Description with HTML removed
add_filter( 'wpseo_metadesc', 'am_enable_shortcodes_removed_html' ); //see https://yoast.com/wordpress/plugins/seo/api/
function am_enable_shortcodes_removed_html($metadesc) {
if( strpos($metadesc, 'et_pb_section') !== FALSE ) {
global $post;
$rendered_content = apply_filters('the_content', $post->post_content);
$newmetadesc = strip_tags( $rendered_content );
return substr($newmetadesc, 0, 156);
@jasperf
jasperf / Vagrantfile
Last active November 28, 2015 13:05 — forked from chiquitto/Vagrantfile
File with vagrant configs for php development for Zend Skeleton Application including MySQL #zend #vagrant #zendframework2
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = '2'
@script = <<SCRIPT
DOCUMENT_ROOT="/var/www/ZendSkeletonApplication/public"
#https://github.com/zendframework/ZendSkeletonApplication.git before running VagrantFile
MYSQL_ROOT_PASSWORD="123456"
#To reset root pw for MySQL See http://askubuntu.com/questions/489098/unable-to-reset-root-password-of-mysql
@jasperf
jasperf / gist:7b3a11672be76bf40baa
Last active February 14, 2016 05:46 — forked from allarmark/gist:a93368fd411d56932b99
Convert broken encoding of WordPress Posts, excerpts and Titles #wordpress #encoding
UPDATE wp_posts SET post_title =
CONVERT(BINARY CONVERT(post_title USING latin1) USING utf8);
UPDATE wp_posts SET post_content =
CONVERT(BINARY CONVERT(post_content USING latin1) USING utf8);
UPDATE wp_posts SET post_excerpt =
CONVERT(BINARY CONVERT(post_content USING latin1) USING utf8);
@jasperf
jasperf / README.md
Created February 16, 2016 11:51 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.

Nginx FastCGI response buffer sizes

By default when Nginx starts receiving a response from a FastCGI backend (such as PHP-FPM) it will buffer the response in memory before delivering it to the client. Any response larger than the set buffer size is saved to a temporary file on disk. This process is also explained at the Nginx ngx_http_fastcgi_module page document page.

Since disk is slow and memory is fast the aim is to get as many FastCGI responses passing through memory only. On the flip side we don't want to set an excessively large buffer as they are created and sized on a per request basis (i.e. it's not shared memory).

The related Nginx options are:

@jasperf
jasperf / A Roots Sage Theme and Dev Setup.md
Last active May 12, 2016 16:38 — forked from corradomatt/Using Roots 8.0 Process.md
Setting up Roots 8.0 (Sage) on a a Mac with Local Yosemite OSX Server and AMP. This includes setting up the server part of things #roots #wordpress #osx
@jasperf
jasperf / wp-config.php
Created July 2, 2016 04:56
WordPress: Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@jasperf
jasperf / new_gist_file.js
Created July 29, 2016 06:56 — forked from haroonabbasi/new_gist_file.js
gulp script to minify Javascript, CSS and compress Images
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
// compress js
/*
gulp.task('default', function() {
return gulp.src('js/*.js')
@jasperf
jasperf / woocommerce-sage-template-part-overrides.md
Created September 4, 2016 12:12 — forked from drawcard/woocommerce-sage-template-part-overrides.md
Woocommerce - Using template part overrides in Sage

So, you know how to override a template file in Woocommerce using Sage, but you're having trouble changing something within the deeper level of that template file. For example, you want to change the output HTML structure of a given part of the product page loop, or incorporate a Bootstrap class into a button element without using Jquery to inject it. Here's how you can override deeper level parts, the default WC theme elements.

Prerequisites

Now you're familiar with how to do Sage + Woocommerce templates, it's time to make it happen.

The template page override

@jasperf
jasperf / gist:521ae5a2da705138737cdbc24c3e4b10
Created December 16, 2016 04:41 — forked from mikejolley/gist:2176823
WooCommerce - Show products from current product category (when viewing a single product)
<?php
if ( is_singular('product') ) {
global $post;
// get categories
$terms = wp_get_post_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) $cats_array[] = $term->term_id;