Skip to content

Instantly share code, notes, and snippets.

View richardtape's full-sized avatar

Richard Tape richardtape

View GitHub Profile
@richardtape
richardtape / install-oh-my-zsh-on-ubuntu
Created August 4, 2014 01:58
Install Oh My ZSH on Ubuntu 14.04
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH
@richardtape
richardtape / nginx-wpcommon.conf
Created July 24, 2014 23:30
nginx rewrite rules for composer-ised WordPress
# First two are for standard WordPress install (non-multisite)
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
# Remove need for /wp/
rewrite ^(/[^/]+)?(/wp-.*) /wp$2 last;
@richardtape
richardtape / unrarall
Created May 14, 2014 18:43
Batch unrar from the command line in Mac OS X
# You'll need to install unrar. See: http://gotofritz.net/blog/tutorials/batch-unrar-command-line-os-x/
# Blog post: http://richardtape.com/?p=291
unrarall(){
# Get our present working directory
iamhere=`pwd`
# find all rars recursively above where we are
find "$iamhere" -name "*.rar" -exec unrar -y -ad x {} \;
data:text/html;charset=utf-8, <title>TextEditor</title> <link rel="shortcut icon" href="http://g.etfv.co/https://docs.google.com"/> <style> html{height: 100%;} body{background: -webkit-linear-gradient(#f0f0f0, #fff); padding: 3%; height: 94%;} .paper { font: normal 12px/1.5 "Lucida Grande", arial, sans-serif; width: 50%; height: 80%; margin: 0 auto; padding: 6px 5px 4px 42px; position: relative; color: #444; line-height: 20px; border: 1px solid #d2d2d2; background: #fff; background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px; background: -webkit-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -moz-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -ms-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -o-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; -webkit-background-size: 100% 20px; -moz-background-size: 100% 20px; -ms-background-size: 100% 20px; -o-background-size: 100% 20p
@richardtape
richardtape / sausage
Created February 1, 2013 13:19
Start of the world's simplest html/css editor, with syntax highlighting. Copy and paste this into your browser url box and hit enter. ToDo: Add a CSS box which then applies to the iframe below. ToDo: Remove the line numbers and spurious 'X' that appears in the iframe ToDo: ? ToDo: Profit.
data:text/html;charset=utf-8, <link rel="shortcut icon" href="http://g.etfv.co/https://docs.google.com"/><title>TextEditor</title> <link rel="shortcut icon" href="http://g.etfv.co/https://docs.google.com"/> <style> html{height: 100%;} body{background: -webkit-linear-gradient(#f0f0f0, #fff); padding: 3%; height: 94%;} .paper { font: normal 12px/1.5 "Lucida Grande", arial, sans-serif; width: 50%; height: 44%; margin: 0 auto; padding: 0; position: relative; color: #444; line-height: 20px; border: 1px solid #d2d2d2; background: #fff; background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px; background: -webkit-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -moz-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -ms-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -o-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; -webkit-background-size: 100% 20px; -moz-background-size: 100% 20px;
@richardtape
richardtape / 1linenotepad.txt
Created January 30, 2013 18:15
A 1line notepad for in-browser copy and pasteyness
data:text/html;charset=utf-8, <title>TextEditor</title> <link rel="shortcut icon" href="http://g.etfv.co/https://docs.google.com"/> <style> html{height: 100%;} body{background: -webkit-linear-gradient(#f0f0f0, #fff); padding: 3%; height: 94%;} .paper { font: normal 12px/1.5 "Lucida Grande", arial, sans-serif; width: 50%; height: 80%; margin: 0 auto; padding: 6px 5px 4px 42px; position: relative; color: #444; line-height: 20px; border: 1px solid #d2d2d2; background: #fff; background: -webkit-gradient(linear, 0 0, 0 100%, from(#d9eaf3), color-stop(4%, #fff)) 0 4px; background: -webkit-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -moz-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -ms-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: -o-linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; background: linear-gradient(top, #d9eaf3 0%, #fff 8%) 0 4px; -webkit-background-size: 100% 20px; -moz-background-size: 100% 20px; -ms-background-size: 100% 20px; -o-background-size: 100% 20p
@richardtape
richardtape / halp.html
Created November 13, 2012 10:56
Workflow
I have a standalone git repo (which is on github) which contains my 'framework'. That framework is a
load of php/css/js/less files, in several subdirectories. I use that framework in all of my projects.
I have another standalone git repo which contains all of my projects.
At the moment, if I update the framework, I then have to copy and paste it into all of my projects,
overwriting the existing stuff in each project folder.
I know! The humanity. Think of the children. But we live in the 21st Century etc.
@richardtape
richardtape / incshortcode.php
Created November 1, 2012 10:34
Possibly fixing the crappy shortcode in the "RAD" dropbox thing for @MrQwest
<?php
extract(shortcode_atts(array("dir" => $directory, "button" => 'Upload To Dropbox!'), $atts));
$rad_dropbox_settings = admin_url( 'admin.php?page=rad_dropbox_settings', '' );
if (empty($wp_settings_check)) { echo '<div class="message-yellow">You must enter your Dropbox account details first! Please go to the <a href="'.$rad_dropbox_settings.'">settings</a> page!</div><br>'; }
echo $message; ?>
<?php
$output = '<form method="POST" enctype="multipart/form-data" class="rad-dropbox-uploader">';
$output .= '<input type="hidden" name="dest" value="$dir" />';
@richardtape
richardtape / gist:3874366
Created October 11, 2012 18:05
Add SVG Mimetype
function my_myme_types($mime_types){
$mime_types['svg'] = 'image/svg+xml';
return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);
@richardtape
richardtape / functions.php
Created September 13, 2012 11:01
WordPress Sidebars for MrQwest
//In your functions.php (or wherever)
register_sidebar(
array(
'id' => 'primary',
'name' => __( 'Primary', 'your_theme' ),
'description' => __( 'The primary sidebar used on pages and posts. By default on the Right Hand Side', 'your_theme' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title"><span class="title">',
'after_title' => '</span></h4>'