Skip to content

Instantly share code, notes, and snippets.

@suth
suth / sortable.js
Created Jan 26, 2017
Vue.js 2.0 Sortable Directive
View sortable.js
import Vue from 'vue'
import Sortable from 'sortablejs'
Vue.directive('sortable', {
inserted: function (el, binding, vnode) {
var sortable = new Sortable(el, binding.value || {});
if (binding.arg) {
if (!vnode.context.sortable) {
vnode.context.sortable = {}
View video-importer-temporary-drafts.php
<?php
/*
Plugin Name: Video Importer Temporary Drafts
Plugin URI: https://refactored.co
Description: Temporarily saves imported posts as a draft so any publishing logic doesn't run until custom fields are saved
Version: 1.0
Author: Refactored Co.
Author URI: https://refactored.co
*/
View video-thumbnails-markup-and-custom.php
<?php
/*
Plugin Name: Find Video Thumbnails in Post and Custom Field
Plugin URI: http://refactored.co
Description: Mod for Video Thumbnails to also scan the post content when a custom field is entered in the settings.
Author: Refactored Co.
Author URI: http://refactored.co
Version: 0.1
License: GPL2
View extend-http-request-timeout.php
<?php
/*
Plugin Name: Extend HTTP Request Timeout
Plugin URI: https://refactored.co
Description: Extends the default timeout length for the WordPress HTTP API
Author: Sutherland Boswell
Author URI: http://sutherlandboswell.com
Version: 1.0
License: GPL2
*/
View wp-conditional-css.php
<?php
function my_css_function() {
if ( is_single() && get_post_meta( get_the_ID(), 'field_key', true ) != '' ) {
wp_enqueue_style( 'style-name', 'folder/stylesheet.css' );
}
}
add_action( 'wp_enqueue_scripts', 'my_css_function' );
@suth
suth / gist:2895907
Created Jun 8, 2012
Quick WordPress Instance
View gist:2895907
#! /bin/bash
clear
echo "WordPress Instance Setup"
echo "========================"
echo
echo "Enter a domain for your site"
read domain
@suth
suth / gist:2640615
Created May 9, 2012
Facebook Thumbnail Class
View gist:2640615
class Facebook_Thumbnails extends Video_Thumbnails_Providers {
// Regex strings
public $regexes = array(
'#"http://www.facebook.com/v/([0-9]+)"#' // Facebook Embed
);
// Thumbnail URL
public function get_thumbnail_url( $id ) {
return 'https://graph.facebook.com/' . $id . '/picture';
You can’t perform that action at this time.