View gist:6123563
find . -name '*.php' -exec grep -Hn 'SEARCHSTRING' '{}' \
grep --include=\*.{php,php6} -rnw './' -ie "SEARCH"
View gist:6123579
find . -type f -printf "%C@ %p\n" | sort -rn | head -n 10
View Unix commands
rename s/"SEARCH"/"REPLACE"/g *
//Replace Text
replace "old_string" "new_string" -- *.php
//Replace with regex
sed -i -- "s/<text .*svg>/<svg>/g" **.svg
//Find text in files
grep --include=\*.{php,php5} -rnw './' -e "NEEDLE"
View gist:6123598
#add prefix
rename s/'^'/'MyPrefix'/ *
#add suffix
rename s/'$'/'MySuffix'/ *
#numbered
n=1; for f in ./*.jpg; do mv "$f" $n.jpg; n=$((n+1)); done
View gist:6123647
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail('medium');
else:
$attachments = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order')); //you may need to change that $post variable
if (is_array($attachments) ){
$first_attachment = array_shift($attachments);
echo wp_get_attachment_image($first_attachment->ID,'medium');
}
else{
View gist:6123743
<h2>Movies</h2>
<?
$args = array(
'post_type' => 'movies',
'showposts' => 12
);
$wp_query = new WP_Query( $args );
while ( have_posts() ) : the_post();
$terms = current(get_the_terms( $post->ID, 'genre' ));
View gist:6123815
<?
//Find the WHILE loop on your index, home or archive and replace with this
?>
<?
$br = 6; //Number or articles to display
$n=0; while ( have_posts() ) : the_post(); if($n==$br){break;} $n++;
?>
View gist:8778594
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
View gist:8778605
$("#content").load("somefile.html");
View gist:8778610
var maxheight = 0;
$("div.col").each(function(){
if($(this).height() > maxheight) { maxheight = $(this).height(); }
});
$("div.col").height(maxheight);