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 / 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 / widget.php
Created March 5, 2014 09:10
widget w/repeater field
<?php
class Nama_Widget_Classes extends WP_Widget {
/*--------------------------------------------------*/
/* Constructor
/*--------------------------------------------------*/
/**
* Specifies the classname and description, instantiates the widget,
@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";
@drrobotnik
drrobotnik / style.scss
Created April 25, 2014 17:19
mixin colors
$brand-colors:
grey #57585b,
orange #d1662a,
purple #632f54,
green #5e6e63,
yellow #d2a732,
blue #006e94,
red #790025;
@drrobotnik
drrobotnik / gist:7c2a33cb9127b7a6dc54
Created May 12, 2014 21:28
wp 3.9 search results
Search: Hello World
SELECT SQL_CALC_FOUND_ROWS wp_posts.id
FROM wp_posts
WHERE 1 = 1
AND ( ( ( wp_posts.post_title LIKE '%hello%' )
OR ( wp_posts.post_content LIKE '%hello%' ) )
AND ( ( wp_posts.post_title LIKE '%world%' )
OR ( wp_posts.post_content LIKE '%world%' ) ) )
AND wp_posts.post_type IN ( 'post', 'page', 'attachment', 'product',