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:2772562
Created May 23, 2012 00:36 — forked from danlamanna/gist:1696532
Example pull database script
#!/bin/bash
SLAVE_DB_USER="foo"
SLAVE_DB_PASS="bar"
SLAVE_DB_NAME="foobar"
SLAVE_DB_HOST="127.0.0.1"
MASTER_DB_USER="production_foo"
MASTER_DB_PASS="foobarbaz"
MASTER_DB_NAME="production"
@drrobotnik
drrobotnik / gist:3118746
Created July 15, 2012 21:38
Creates wordpress posts/pages from an array.
function lazy_sitemap(){
$generated = get_option('sitemap_generated');
if($generated!=1){
$sitemap = "Our Software Framework
Who we Help
Benefits of our Software
BPM Explained
Services
Company
About Us
@drrobotnik
drrobotnik / sitemap.php
Created August 8, 2012 21:41
wp scandir sitemap generator
if(0){
$generated = get_option('sitemap_generated');
if($generated!=6){
$default_pages = array_diff(scandir(get_stylesheet_directory().'/inc/pages/'), array('..', '.','.DS_Store','.TemporaryItems','.com.apple.timemachine.supported','.htaccess','.localized','.svn','index.php'));
$existing_pages = get_pages();
$temp = array();
foreach ($existing_pages as $page) {
$temp[] = $page->post_title;
}
{
"build_systems":
[
{
"cmd":
[
"mysql -uxxxx -pxxxx -e 'create database ${project_name/.sublime-project//}'"
],
"name": "CREATE PROJECT DB",
"path": "~/bin/",
@drrobotnik
drrobotnik / gist:4562249
Created January 18, 2013 04:00
Modified snippet from Kovshenin. echoing out a multisites list of subdomains for easy copy pasting into your local hosts file.
/* Repurposed from: http://kovshenin.com/2012/wordpress-multisite-with-wildcard-subdomains/
** I found that giving each subdomain their own entry ran significantly faster.
*/
add_action( 'wp_footer', 'print_entry_for_hosts_file' );
function print_entry_for_hosts_file() {
global $wpdb;
$domains = $wpdb->get_col( "SELECT domain FROM $wpdb->blogs;" );
foreach($domains as $domain){
echo "127.0.0.1 " . $domain . "\n";
<?php
/**
* Additional setup for our freshly baked Ad Code Manager v0.2
* Not tested with v0.1
*
* Quick config for DFP JS API
*
*/
// Add additional output tokens
@drrobotnik
drrobotnik / gist:8526914
Created January 20, 2014 19:06
autoheight div w/ratio
function aspectRatioRespond(){
elements = jQuery('[data-ratio]');
console.log(elements);
elements.each(function(){
container = jQuery(this);
autoHeight = container.data('ratio');
ratio = autoHeight.match(/(\d+)\:(\d+)/);
ratio = ratio[1] / ratio[2];
console.log(ratio);
container.height( container.width() / ratio );
@drrobotnik
drrobotnik / gist:8590892
Created January 24, 2014 02:12
iossliderdemo
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width=device-width, minimum-scale=1, maximum-scale=1">
<!-- META -->
<meta charset = "utf-8">
@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{