Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View richardtape's full-sized avatar

Richard Tape richardtape

View GitHub Profile
@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 {} \;
@richardtape
richardtape / saved-me-hours-and-hours.sh
Created May 7, 2015 23:39
Create multiple composer.json files automatically with name of directory and push to repos
# Scenario: You have a lot (say, 200+) plugins/themes/whatevers that you need to add to a composer setup
# and none of them have composer.json files. Also, none of them are on a git repo anywhere
# Here's how I solved this problem which would have taken days to do manually
# To get git repo in each directory and then push existing code to appropriate repo
for d in ./*/ ; do (cd "$d" && git init); done
for d in ./*/ ; do (cd "$d" && git add .); done
# To allow an empty commit message, don't judge me
git config --global alias.nccommit 'commit -a --allow-empty-message -m ""'
if(has_post_thumbnail())
{
the_post_thumbnail();
}
//the_post_thumbnail() can take an argument of an image size
//http://codex.wordpress.org/Function_Reference/the_post_thumbnail
@richardtape
richardtape / Lemon.html
Created May 23, 2012 15:58
not implemented
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title></title>
<!-- ||| Meta information for search engine goodness and iThings ||| -->
<meta charset="utf-8">
<ul>
<li><a href="http://earth.local.significantlybetter/shop/?range=-29">Under <span class="pricedisplay">£30.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=30-39"><span class="pricedisplay">£30.00</span> - <span class="pricedisplay">£39.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=40-59"><span class="pricedisplay">£40.00</span> - <span class="pricedisplay">£59.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=60-99"><span class="pricedisplay">£60.00</span> - <span class="pricedisplay">£99.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=100-239"><span class="pricedisplay">£100.00</span> - <span class="pricedisplay">£239.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=240-">Over <span class="pricedisplay">£240.00</span></a></li>
<li><a href="http://earth.local.significantlybetter/shop/?range=all">Show All</a></li>
</ul>
@richardtape
richardtape / .php
Created June 28, 2012 15:34
Simple WordPress widget for the ResponsiveSlides Slider - uses a post category to load posts
<?php
if( !class_exists( 'friendly_responsiveslides_slider' ) )
{
/**
* Friendly ResponsiveSlider using http://responsive-slides.viljamis.com/
*
* @package Earth
* @author iamfriendly
<?php global $post; $protected = ( !empty( $post->post_password ) ) ? "custom_class" : ""; ?>
<body <?php body_class( $protected ); ?>>
.
.
.
</body>
@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>'
@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 / 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" />';