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%/' );
@drrobotnik
drrobotnik / sass_array.scss
Created January 31, 2014 18:38
sass index array for brand colors
$brand-colors: (
#57585b, // grey
#d1662a, // orange
#632f54, // purple
#5e6e63, // green
#d2a732, // yellow
#006e94, // blue
#790025 // red
);
function aspectRatioRespond(){
mobileMax = 480;
elements = jQuery('[data-ratio]');
elements.each(function(){
container = jQuery(this);
var elRatio = container.data('ratio');
var elMobileRatio = ( typeof container.data('mobile-ratio') == 'string' ) ? container.data('mobile-ratio') : container.data('ratio');
if(container.width() < mobileMax){
autoHeight = elMobileRatio;
}else{
@drrobotnik
drrobotnik / gist:8831455
Created February 5, 2014 19:41
remote_get
function remote_get($key, $url, $args = array(), $expiration = 604800 ){
if( empty( $expiration ) ){
$results = get_option( $key );
}else{
$results = get_transient( $key );
}
if ( false === $results ) {
$response = wp_remote_get($url, $args);
@drrobotnik
drrobotnik / main.js
Created February 28, 2014 01:12
whyuno
$('.event-gallery a').magnificPopup({
type: 'ajax',
callbacks: {
close: function() {
// destroy the slider to avoid memory leaks
this.content.find('.royalSlider').data('royalSlider').destroy();
}
}
});
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 6ae41ab..98330c3 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -12,6 +12,7 @@ jQuery(document).ready(function($) {
type: 'ajax',
ajax: {
settings: {
+ verticalFit: true,
dataType: 'html'
@drrobotnik
drrobotnik / gist:9966070
Created April 4, 2014 01:08
Theme Docs
add_action('save_post', 'cv_on_post_update_flush_transient');
add_action('admin_menu', 'cv_docs_menu');
function cv_docs_menu() {
$page = get_stylesheet_directory() . '/doc/index.html';
if( file_exists( $page ) ){
add_menu_page('Theme Documentatio', 'Theme Docs', 'edit_posts', 'cv_docs', 'cv_docs_page', 'dashicons-format-aside', 200);
}
}
@drrobotnik
drrobotnik / functions.php
Created April 10, 2014 21:35
leadin custom welcome message
function cv_leadin_subscribe_email( $fields ){
$body = file_get_contents( get_stylesheet_directory() . '/leadin/email.html' );
$replacements = array();
foreach ( $fields as $field ) {
$brace_label = "{" . ucwords( $field['label'] ) . "}";
$replacements[$brace_label] = $field['value'];
}
$body = strtr($body, $replacements);
return $body;
@drrobotnik
drrobotnik / config.rb
Created April 17, 2014 16:23
config.rb setup
# 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 / gist:11278295
Created April 25, 2014 05:16
mixin output
@font-face {
font-family: "Nexa";
src: url("nexa/nexa_regular-webfont.eot?76871668");
src: url("nexa/nexa_regular-webfont.eot?76871668#iefix") format("embedded-opentype"), url("nexa/nexa_regular-webfont.woff?76871668") format("woff"), url("nexa/nexa_regular-webfont.ttf?76871668") format("truetype"), url("nexa/nexa_regular-webfont.svg?76871668#rosche") format("svg");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "Nexa";