Skip to content

Instantly share code, notes, and snippets.

View skyebook's full-sized avatar

Skye Book skyebook

View GitHub Profile
@skyebook
skyebook / gist:4262228
Created December 11, 2012 21:21
WPDB::Prepare Fix for WordPress 3.5
<?php
// Old (single argument) function call
global $wpdb;
$authorIDs = $wpdb->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1");
// New (two argument) function call
global $wpdb;
$authorIDs = $wpdb->get_col($wpdb->prepare("SELECT post_author FROM " . $wpdb->posts . " WHERE ID = " . intval($postID) . " LIMIT 1", array()));
?>
@skyebook
skyebook / gist:5006682
Created February 21, 2013 17:54
Installing MicroArmy on Ubuntu
#!/bin/sh
# This script will install the dependencies needed for MicroArmy to be installed.
sudo apt-get install build-essential python-dev libevent-dev
sudo pip install -U eventlet paramiko boto pyyaml
git clone git://github.com/j2labs/microarmy.git
list.subList(offset > activityItems.size() ? activityItems.size() : offset, limit > (offset + activityItems.size()) ? activityItems.size() : offset+limit);
@skyebook
skyebook / apt-s3-installer.sh
Created May 29, 2013 16:29
This will install apt-s3
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:businessoptics/packages
sudo apt-get update
sudo apt-get install -y apt-transport-s3
@skyebook
skyebook / gist:5935728
Created July 5, 2013 16:38
Create Cookbook in Subdirectory
mkdir my_app_cookbook
cd my_app_cookbook
git init
knife cookbook create my_app -o ./
@skyebook
skyebook / wp_permissions_reset.sh
Created July 8, 2013 16:23
Reset WordPress file and directory permissions
cd /my/wordpress/location
sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
import urllib2, urlparse, sys, webbrowser
itags = {'45': 'webm_720p',
'44': 'webm_480p',
'43': 'webm_360p',
'38': 'mp4_3072p',
'37': 'mp4_1080p',
'36': 'phone_mp4_240p',
'35': 'flv_480p',
'34': 'flv_360p',
@skyebook
skyebook / push-defense.sh
Last active August 29, 2015 14:10
push-defense
#!/bin/bash
gitResult=$(git --version | grep 'git version 2.')
if [ -n "$gitResult" ]; then
# Don't push to any remotes unless a remote branch is specified
git config --global push.default nothing
mkdir -p ~/bin/git-hooks/hooks
@skyebook
skyebook / UnfuckedButton.m
Created February 1, 2015 01:03
Put titleLabel under UIButtton imageView
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
// Can't reference titleLabel directly in here, so get the frame by calling into the UIButton implementation
CGRect defaultTitleFrame = [super titleRectForContentRect:contentRect];
CGSize titleSize = defaultTitleFrame.size;
CGPoint imageCenter = self.imageView.center;
return CGRectMake(imageCenter.x - (titleSize.width/2), imageCenter.y+titleSize.height, titleSize.width, titleSize.height);
}
@skyebook
skyebook / ExportWindow.mel
Last active August 29, 2015 14:19
Betaville Batch Exporter for Maya
-title "RE-Export building .DAE"
-widthHeight 100 100;
rowLayout -numberOfColumns 2;
columnLayout -adjustableColumn true;
button -label "A-------MoveTool-----------------"
-command
MoveTool;
EnterEditMode;
ctxEditMode;
button -label "B-------CenterPivot-------------"