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 |
#!/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 |
#!/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. |
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 |
// 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 |
<?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; |
<?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 ) |
<?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] |
<?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 | |
*/ |
<?php | |
function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) { | |
// Only do this if we're getting the file URL | |
if (! $permalink) { | |
// This returns an array of (url, width, height) | |
$image = wp_get_attachment_image_src( $post_id, 'large' ); | |
$new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\'', $content ); | |
return $new_content; | |
} | |
} |
<?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); | |
} | |
} | |
?> |