Skip to content

Instantly share code, notes, and snippets.

View foliovision's full-sized avatar

Alec Kinnear foliovision

View GitHub Profile
@foliovision
foliovision / Textile.sh
Created November 8, 2011 17:35 — forked from dpk/Textile for BBEdit
Working version of Textile.sh filter for BBEdit/TextWrangler. http://foliovision.com/2011/11/08/textile-editing-bbedit
#!/usr/bin/php -q
<?php
// set to true to avoid ' and " converting to HTML special characters
@define('skip_glyphs', false);
// 3+ uppercase span tag is commented out, as everyone hates it
// instruction on how to use it available here: http://foliovision.com/2011/11/08/textile-editing-bbedit
// define these before including this file to override the standard glyphs
@foliovision
foliovision / wp-mu-in-subdirectory.php
Created January 19, 2015 16:28
WP Multisite fix for WP install in a directory
<?php
/*
Our Wordpress is located in https://our-site.com/wordpress
Here's the relevant part of our wp-config.php
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'our-site.com');
@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;
}
@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 / bbpress-subscribers-convert.php
Created May 24, 2016 14:34
Convert bbPress 1 favorite topics into topic subscriptions in bbPress 2
<?php
include('wp-load.php');
global $wpdb;
$aUsers = $wpdb->get_results("SELECT user_id,meta_value FROM $wpdb->usermeta WHERE meta_key = 'bb_favorites'");
$i = 0;
foreach($aUsers as $user){
@foliovision
foliovision / bbpress-fix-post-position.php
Created May 24, 2016 14:45
Fix bbPress 1 post positions
<?php
include('bb-load.php');
global $bbdb;
$aTopics = $bbdb->get_col( "SELECT topic_id FROM $bbdb->topics" );
foreach( $aTopics AS $iTopic ) {
echo $iTopic.'<br />';
bb_update_post_positions($iTopic);
}
@foliovision
foliovision / bbpress-conversion-clean-up.php
Created May 24, 2016 14:50
bbPress 1 to bbPress 2 cleanup tool
<?php
/*
Please read the bbPress 1 conversion article on foliovision.com before using
*/
include('wp-load.php');
global $wpdb;
$aPosts = $wpdb->get_results( "SELECT * FROM $wpdb->posts AS p JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type IN ('forum','topic','reply') AND ( meta_key = '_bbp_old_topic_id' ) LIMIT 10000 " );
<?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 / 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 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()
} );