Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Jonathan Bossenger jonathanbossenger

🏠
Working from home
Block or report user

Report or block jonathanbossenger

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
@jonathanbossenger
jonathanbossenger / DuskServiceProvider.php
Created Sep 19, 2019
Custom ServiceProvider to register scrollToElement macro for Dusk browser testing
View DuskServiceProvider.php
<?php
namespace App\Providers;
use Laravel\Dusk\Browser;
use Illuminate\Support\ServiceProvider;
class DuskServiceProvider extends ServiceProvider
{
/**
@jonathanbossenger
jonathanbossenger / sitesetup.sh
Last active Nov 8, 2019
Bash script to automatically create Apache vhosts
View sitesetup.sh
#!/bin/sh
SITE_NAME=$1
SITE_CONFIG_PATH=/etc/apache2/sites-available/$SITE_NAME.conf
SSL_SITE_CONFIG_PATH=/etc/apache2/sites-available/$SITE_NAME-ssl.conf
echo "Setting up virtual hosts..."
cd /etc/apache2/sites-available/
View custom_ssp_widget_series_episodes_args.php
<?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;
}
View my_custom_feed_item_author.php
<?php
add_filter('ssp_feed_item_author', 'ssp_my_custom_feed_item_author');
function ssp_my_custom_feed_item_author(){
return 'John Smith - CEO';
}
View public-and-private-podcasts.php
<?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' );
View simple-bulk-episodes.php
<?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 );
}
View replace_wordpress_feed_with_podcast_feed.php
<?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 Jun 26, 2019 — forked from hlashbrooke/functions.php
Seriously Simple Podcasting: Add blog categories to podcast episodes (admin).
View functions.php
add_action( 'init', 'ssp_add_categories_to_podcast', 12 );
function ssp_add_categories_to_podcast () {
register_taxonomy_for_object_type( 'category', 'podcast' );
}
View gist:a3276f05c08044991ba246719d4893ff
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')
}
});
@jonathanbossenger
jonathanbossenger / mysql-backup.sh
Created Feb 17, 2019
Backup all MySQL databases on the command line
View mysql-backup.sh
#!/bin/bash
USER="root"
PASSWORD="password"
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
for db in $databases; do
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
echo "Dumping database: $db"
You can’t perform that action at this time.