Skip to content

Instantly share code, notes, and snippets.

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

Jonathan Bossenger jonathanbossenger

🏠
Working from home
View GitHub Profile
@jonathanbossenger
jonathanbossenger / sitedrop.sh
Last active March 22, 2022 19:43
Bash script to automatically decommission LAMP sites
#!/bin/bash
# Bash script to set drop local site created by sitesetup script
# See https://gist.github.com/jonathanbossenger/2dc5d5a00e20d63bd84844af89b1bbb4
SSL_CERTS_DIRECTORY=/home/jonathan/ssl-certs
SITES_DIRECTORY=/home/jonathan/development/websites
SITE_NAME=$1
MYSQL_DATABASE=$(echo $SITE_NAME | sed 's/[^a-zA-Z0-9]//g')
@jonathanbossenger
jonathanbossenger / DuskServiceProvider.php
Created September 19, 2019 15:23
Custom ServiceProvider to register scrollToElement macro for Dusk browser testing
<?php
namespace App\Providers;
use Laravel\Dusk\Browser;
use Illuminate\Support\ServiceProvider;
class DuskServiceProvider extends ServiceProvider
{
/**
@jonathanbossenger
jonathanbossenger / sitesetup.sh
Last active April 25, 2024 23:13
Bash script to automatically provision LAMP sites
#!/bin/bash
# Bash script to set up local site using LAMP on Ubuntu
# Requires Apache2, MySQL, mkcert (https://github.com/FiloSottile/mkcert)
# See also sitedrop.sh https://gist.github.com/jonathanbossenger/4950e107b0004a8ee82aae8b123cce58
HOME_USER=jonathan
SSL_CERTS_DIRECTORY=/home/jonathan/ssl-certs
SITES_DIRECTORY=/home/jonathan/development/websites
<?php
add_filter( 'ssp_widget_series_episodes_args', 'custom_ssp_widget_series_episodes_args' );
function custom_ssp_widget_series_episodes_args( $arguments ) {
$arguments['posts_per_page'] = 10;
return $arguments;
}
@jonathanbossenger
jonathanbossenger / my_custom_feed_item_author.php
Created August 2, 2019 10:08
Add a custom feed item author
<?php
add_filter('ssp_feed_item_author', 'ssp_my_custom_feed_item_author');
function ssp_my_custom_feed_item_author(){
return 'John Smith - CEO';
}
<?php
//Hook into the ssp_episode_query_args to show episode stats for all public and private podcasts
add_filter( 'ssp_episode_query_args', 'ssp_episode_query_args_callback', 10, 2 );
function ssp_episode_query_args_callback( $args, $context ) {
if ( 'stats' !== $context ) {
return $args;
}
$args['post_status'] = array( 'publish', 'private' );
<?php
// add audio file duration to a podcast when using Simple Bulk Uploader
global $ss_podcasting;
$duration = $ss_podcasting->get_file_duration( $file );
if ( $duration ) {
update_post_meta( $post_id, 'duration', $duration );
}
<?php
remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'prefix_podcast_rss_feed', 10, 1 );
function prefix_podcast_rss_feed() {
load_template( SSP_PLUGIN_PATH . '/templates/feed-podcast.php' );
}
@jonathanbossenger
jonathanbossenger / functions.php
Created June 26, 2019 12:22 — forked from hlashbrooke/functions.php
Seriously Simple Podcasting: Add blog categories to podcast episodes (admin).
add_action( 'init', 'ssp_add_categories_to_podcast', 12 );
function ssp_add_categories_to_podcast () {
register_taxonomy_for_object_type( 'category', 'podcast' );
}
@jonathanbossenger
jonathanbossenger / gist:a3276f05c08044991ba246719d4893ff
Created February 20, 2019 19:12
Check for valid email example
jQuery(function ($) {
$( document ).ready(function() {
$(“.diviclick”).on(“click”, function(){
event.preventDefault();
if ($('#email').val().length > 0){
$(‘#guiarapidaoptin’).submit();
}else {
alert('A valid email address is required')
}
});