Skip to content

Instantly share code, notes, and snippets.

View foliovision's full-sized avatar

Alec Kinnear foliovision

View GitHub Profile
@foliovision
foliovision / set-up-secure-mac.md
Last active March 10, 2023 16:42
How to Set Up a Mac Securely for OS X Sierra

Securing the Computer

  1. don't plug in to internet
  2. chose a country (United Kingdom)
  3. refuse to share any info with apple or log in to iCloud (to make sure you don't get sucked in early)
  4. refuse location services
  5. restart
  6. still a German computer
    1. add a new language in Regions preferences
    2. some dialogues (restarting) still come in German after deleting German
@foliovision
foliovision / FV Player custom Ajax tracking.js
Last active October 12, 2022 12:07
Sample code for FV Player which detects if the user really watched the video to the end (seeking to the end won't suffice) and then sends the post ID using Ajax.
flowplayer( function(api,root) {
var root = jQuery(root);
api.bind('progress', function(e,api,current) {
fv_track(e,api,current);
}).bind('finish ready ', function(e,api) {
for( var j in fv_ga_events ) {
root.removeData('fv_custom_track_'+fv_ga_events[j]);
}
});
@foliovision
foliovision / wp_is_mobile-wp-rocket.php
Created February 20, 2020 14:07
Make wp_is_mobile() use WP Rocket mobile detection
<?php
/*
Core WordPress function wp_is_mobile() detects iPad as mobile, so we filter it and use WP Rocket mobile detection
*/
add_filter( 'wp_is_mobile', 'fv_bra_wp_is_mobile' );
function fv_bra_wp_is_mobile( $is_mobile ) {
if ( class_exists( 'Rocket_Mobile_Detect' ) ) {
$detect = new Rocket_Mobile_Detect();
@foliovision
foliovision / fv-player-memberpress-courses-fix.php
Last active March 31, 2022 14:44
FV Player - fix for MemberPress Courses as it doesn't run with wp_footer()
<?php
/*
* Plugin Name: FV Player - MemberPress Courses fix
* Version: 0.2
* Description: Since memberpress-courses/app/views/classroom/courses_footer.php doesn't contain wp_footer hook we have to provide an alternative way of loading FV Player scripts. Here's another description of the issue: https://blog.calendarscripts.info/watu-watupro-and-memberpress-temporary-solution-to-an-issue/
* Author: Foliovision
* Author URI: https://foliovision.com
*/
@foliovision
foliovision / fv-player-handle-video-tags.php
Last active May 10, 2021 09:47
FV Player Bridge for HTML video tags
<?php
/*
Plugin Name: FV Player - Handle video tags
Description: Changes any <video> tag to FV Player
Author: Foliovision
Version: 0.2
Author URI: https://foliovision.com
*/
@foliovision
foliovision / fv-player-custom-cdn.php
Created May 5, 2021 21:06
Add another CDN for FV Player Pro with custom URL token generator
<?php
/*
Plugin Name: FV Player Pro - Custom CDN
Description: Add Settings -> FV Player Pro -> Hosting -> BunnyCDN Extended which signs the URLs for use in SK and US countries only.
Author: Foliovision
Version: 0.1
*/
add_action( 'plugins_loaded', 'fv_player_custom_cdn_load', 0 );
var player = jQuery('<div id="background-video"></div>');
jQuery('#wp-custom-header').append(player);
player.flowplayer( {
autoplay: true,
disabled: true,
loop: true,
clip:
{
"sources": [
{ src: "https://s3-eu-west-1.amazonaws.com/fv-player-unprotected/dominika-960-31_HD.mp4", type: "video/mp4" }
@foliovision
foliovision / FV Player unload on magnificPopup closing.js
Created February 2, 2018 12:26
FV Player unload on magnificPopup closing
jQuery(document).on('mfpClose', function() {
jQuery('.flowplayer').data('flowplayer').unload()
} );
<?php
add_action( 'wp_enqueue_scripts', 'tweak_fv_player_css_enqueue' );
function tweak_fv_player_css_enqueue() {
global $fv_fp;
if( method_exists( $fv_fp, 'css_enqueue' ) {
$fv_fp->css_enqueue(true);
}
}
@foliovision
foliovision / fv-pb-global-avatar.php
Last active October 24, 2016 11:40
Profile Builder - make the custom avatars global for WP Multisite
<?php
if( is_multisite() && function_exists('switch_to_blog') ) {
add_filter( 'get_avatar', 'fv_pb_global_avatar_start', 20, 5 );
add_filter( 'get_avatar', 'fv_pb_global_avatar_end', 22, 5 );
function fv_pb_global_avatar_start( $avatar ) {
switch_to_blog(1);
return $avatar;
}