Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
sosukeinu / backup.sh
Created January 25, 2013 20:11
BASH backup script
#!/bin/bash
year="$1"
month="$2"
day="$3"
server_name='interactivedept'
backup_repository() {
repo_name="$1"
svnadmin hotcopy /home/repo/$repo_name /home/backup/$repo_name-repo
@sosukeinu
sosukeinu / rss-subscribers.sh
Created January 25, 2013 20:11 — forked from btobolaski/rss-subscribers.sh
BASH cron job to list RSS subscribers
#!/bin/bash
# A modification of Marco Arment's script at
#
# https://gist.github.com/3783146
#
# It's intended to be run once a day as a cron job. The main
# differences between it and Marco's script are:
#
# 1. It checks two feeds instead of just one.
@sosukeinu
sosukeinu / Sublime-Text2-useful-shortcuts.md
Last active December 11, 2015 17:49 — forked from mingliangguo/gist:3291698
CONFIG Sublime Text 2 useful shortcuts

h1. Sublime Text 2 - Useful Shortcuts (Mac OS X)

h2. General

| ⌘T | go to file | | ⌘⌃P | go to project | | ⌘R | go to methods | | ⌃G | go to line | | ⌘KB | toggle side bar | | ⌘⇧P | command prompt |

@sosukeinu
sosukeinu / Preferences.sublime-settings
Created January 25, 2013 20:11 — forked from fpinzn/Preferences.sublime-settings
CONFIG Sublime Text 2 settings
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/RailsCasts Colour Scheme/RailsCastsColorScheme.tmTheme",
// Note that the font_face and font_size are overriden in the platform
@sosukeinu
sosukeinu / wp_tax_bread_functions.php
Last active December 11, 2015 17:49 — forked from billerickson/gist:1325540
WP function taxonomy breadcrumbs
<?php
/* Taxonomy Breadcrumb */
function be_taxonomy_breadcrumb() {
// Get the current term
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
// Create a list of all the term's parents
$parent = $term->parent;
while ($parent):
$parents[] = $parent;
@sosukeinu
sosukeinu / functions.php
Created January 29, 2013 16:03
WP gallery excerpt, taking *hidden* images into account
<?php
// Check a Post for shortcode Galllery
function gallery_shortcode_exists(){
global $post;
# Check the content for an instance of [gallery] with or without arguments
$pattern = get_shortcode_regex();
if(
preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
@sosukeinu
sosukeinu / wp_auto_thumbnail_functions.php
Created January 29, 2013 16:07
WP function auto featured image
<?php
/*
* This function will get the first image in this order:
*
* 1) Featured image
* 2) First image attached to post
* 3) First image URL in the content of the post
* 4) YouTube screenshot
* 5) Default images for different categories [SET MANUALLY]
@sosukeinu
sosukeinu / wp_cat_to_format_functions.php
Created January 29, 2013 16:10
WP function category to post format
<?php
/*
Plugin Name: WPSE53245 - Set Tweet category posts as Aside
Plugin URI: http://http://wordpress.stackexchange.com/questions/53235
Description: Set Tweet category posts as Aside
Version: 0.1
Author: Ashfame
Author URI: http://wordpress.stackexchange.com/users/1521/ashfame
*/
@sosukeinu
sosukeinu / wp_gallery_link_large_image_functions.php
Created January 29, 2013 16:14
WP function gallery attachment link to *large* image
@sosukeinu
sosukeinu / wp_strip_img_post_form_image_functions.php
Created January 29, 2013 16:17
WP function strip *img* from post content *if* post format is *image*
<?php
// Strip Images from Content if Post Format Image
add_filter('the_content', 'strip_images',2);
if ( has_post_format( 'image', $postID )) {
function strip_images($content){
return preg_replace('/<img[^>]+./','',$content);
}
}
?>