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
/**
* Jon Brown's Local WordPress configuration file
*
* @Author Jon Brown <http://wanderingjon.com>
* @Version 3.0
* @Author URI http://www.jbrownstudios.com
* @Atributuon Mark Jaquith <http://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/>
* @License GPLv2
*/
@joshuadavidnelson
joshuadavidnelson / exclude-scripts.php
Last active January 4, 2016 00:39
Exclude scripts from Scripts to Footer plugin, place them back into the wp_head
<?php
/**
* Exclude scripts from Scripts to Footer plugin
* http://wordpress.org/plugins/scripts-to-footerphp/
*
* In this example, we will use jQuery (hosted on Google's servers even)
*/
add_action( 'wp_print_styles', 'jdn_deregister_scripts', 100 );
add_action( 'wp_head', 'jdn_head_scripts' );
@danielalvarenga
danielalvarenga / Vagrantfile
Created December 16, 2015 14:03
Vagrant with shell script provision customizable
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.network :private_network, ip: "10.11.12.13"
config.ssh.forward_agent = true
config.vm.synced_folder ".", "/vagrant"
config.vm.boot_timeout = 120
@jasperf
jasperf / file-permissions-with-numbers
Last active June 30, 2016 03:21
Show chmod file permissions from the command line with numbers (octals) using stat #chmod #permissions #unix
stat -c "%a %n" *
// -c is for file format, %a is for octal, %n is for file name
//http://geeklog.adamwilson.info/article/58/getting-file-permissions-in-octal-on-OS-X
//OSX Yosemite does not work with -c use:
stat -f '%A %a %N' *
@sunriseweb
sunriseweb / functions.php
Created January 23, 2015 22:22
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);
@gareth-gillman
gareth-gillman / functions.php
Created August 27, 2016 13:20
WordPress Plugin Template Include
add_filter('template_include', 'my_function_name', PHP_INT_MAX, 2 );
function my_function_name( $template ) {
if(is_page('about')){
$template = dirname( __FILE__ ) . '/templates/about.php';
}
return $template;
}
@frank-dspeed
frank-dspeed / create_sftp_user.sh
Last active February 28, 2018 07:20
Setup SFTP Only users
#!/bin/bash
#Setup SFTP Group and Service
function setup(){
#Create sftpusers group.
sudo groupadd sftpusers
#Comment out setting disabling SFTP access from sshd config file.
sudo sed -i "s/Subsystem sftp \/usr\/lib\/openssh\/sftp-server/#Subsystem sftp \/usr\/lib\/openssh\/sftp-server/" /etc/ssh/sshd_config
/**
* WooCommerce Quanity buttons add-back
*/
jQuery( function( $ ) {
var $testProp = $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).find('qty');
if ($testProp && $testProp.prop('type') != 'date') {
// Quantity buttons
$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
// Target quantity inputs on product pages
@fregante
fregante / README.md
Last active March 28, 2019 04:26
OS X connection monitor

Connection monitor

Note: if you need a simple connection icon, check out BitBar and its internet checker plugin.

This program notifies you when Internet goes down and when it comes back up.

It pings Google's DNS every 4 seconds; when a ping fails it quickly tries a few more times and switches to downtime mode. When Internet is available again, the cycle restarts.

Tools used