Skip to content

Instantly share code, notes, and snippets.

View drrobotnik's full-sized avatar

Brandon drrobotnik

  • ThermoFisher Scientific
  • San Diego
View GitHub Profile
@drrobotnik
drrobotnik / functions.php
Last active August 26, 2015 17:20
canon redirect
/*
* Request is to set up 301 redirects for permalink change.
* permalink changing from:
* http://vip.local/blog/2015/06/27/hello-world/
* to:
* http://vip.local/blog/uncategorized/hello-world-1/
*/
// Successfully applies new url structure
wpcom_vip_load_permastruct( '/%category%/%postname%-%post_id%/' );
<!-- `the-neverending-homepage` is included in the concatenated jetpack.css -->
<link rel='stylesheet' id='mediaelement-css' href='http://goldenhourstudios.com/wp-includes/js/mediaelement/mediaelementplayer.min.css?ver=2.16.2' type='text/css' media='all' />
<link rel='stylesheet' id='wp-mediaelement-css' href='http://goldenhourstudios.com/wp-includes/js/mediaelement/wp-mediaelement.css?ver=4.2.4' type='text/css' media='all' />
<link rel='stylesheet' id='jetpack_css-css' href='http://goldenhourstudios.com/wp-content/plugins/jetpack/css/jetpack.css?ver=3.6.1' type='text/css' media='all' />
<script type='text/javascript' src='http://goldenhourstudios.com/wp-includes/js/jquery/jquery.js?ver=1.11.2'></script>
<script type='text/javascript' src='http://goldenhourstudios.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='http://goldenhourstudios.com/wp-content/plugins/jetpack/_inc/spin.js?ver=1.3'></script>
<script type='text/javascript' src='http://goldenhour
@drrobotnik
drrobotnik / gist:7a7a2eb4c04031ee03a1
Created August 12, 2015 22:27
url_shortener_shortener
function short_url_replace( $matches ) {
return '>' . $matches[1] . '/' . $matches[2] . '<';
}
function cv_short_url_truncator( $text ) {
$urls = apply_filters( 'cv_short_url_services', array( 't.co', 'bit.ly', 'ow.ly' ) );
return preg_replace_callback( "/]*>http[s]?:\/\/(".implode("|", $urls).")\/([^<]{3})[^<]+</", "short_url_replace", $text );
}
foreach($timeline as $tweet) {
@drrobotnik
drrobotnik / .zshrc-example
Last active August 29, 2015 14:26
traverse
cdd() {
cd `php ~/bin/traverse $1`
}
@drrobotnik
drrobotnik / gulpfile.js
Created June 30, 2015 19:52
gulpfile.js
var gulp = require('gulp');
var rename = require('gulp-rename');
var postcss = require('gulp-postcss');
var postcssImport = require('postcss-import');
var postcssSimpleVars = require('postcss-simple-vars');
var postcssCalc = require('postcss-calc');
var colorFunction = require('postcss-color-function');
var sprites = require('postcss-sprites');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer');
@drrobotnik
drrobotnik / gist:293f9aafd03bc7b51506
Last active August 29, 2015 14:23
remove wp_rollback for certain cases
<?php
// Untested Gist
function remove_wp_rollback() {
if( class_exists( 'WP_Rollback' ) ) :
if( ! current_user_can( 'invented_cap' ) ) :
remove_action( 'plugins_loaded', array( 'WP_Rollback', 'load_textdomain' ) );
//Admin
remove_action( 'admin_enqueue_scripts', array( 'WP_Rollback', 'scripts' ) );
remove_action( 'admin_menu', array( 'WP_Rollback', 'admin_menu' ), 20 );
/*!
Theme Name: Joe & Patience
Theme URI: http://underscores.me/
Author: Brandon Lavigne
Author URI: http://caavadesign.com
Description: Custom Theme developed for Joe & Patience Photography
Version: 1.0
License: GNU General Public License
License URI: license.txt
Tags:
{
"name": "jpatience",
"private": true,
"dependencies": {
"bootstrap-sass-official": "~3.3.1",
"modernizr": "~2.8.1",
"fontawesome": "~4.3.0",
"matchHeight": "~0.5.2",
"jasny-bootstrap": "~3.1.3",
"smooth-scroll": "https://github.com/cferdinandi/smooth-scroll.git",
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "./"
css_dir = "/"
sass_dir = "scss"
images_dir = "img"
javascripts_dir = "js"
fonts_dir = "fonts"
@drrobotnik
drrobotnik / base.php
Created June 1, 2015 18:31
template_part
$post_data = implode('-', array_filter( array( get_post_type(), get_post_format() ) ) );
get_template_part('header', $post_data );