Skip to content

Instantly share code, notes, and snippets.

@JackuB
JackuB / gist:7155562
Created October 25, 2013 14:29
WordPress: find all post thumbnails that match criteria // remove those unfitting
<?php
$args = array('posts_per_page' => -1); // get all posts
$attachments = get_posts( $args );
$allP = 0;
$wThumb = 0;
$great = 0;
$ok = 0;
$wrong = 0;
if ( $attachments ) {
foreach ( $attachments as $post ) {
@JackuB
JackuB / gist:3129182
Created July 17, 2012 12:36
console.log for IE8
var alertFallback = true;
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {};
if (alertFallback) {
console.log = function(msg) {
alert(msg);
};
} else {
console.log = function() {};
}
@JackuB
JackuB / gist:2929739
Created June 14, 2012 11:25
get youtube video thumbnail
<?php
$json = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/tSwWeFWPyUI?v=2&alt=jsonc"));
echo '<img src="' . $json->data->thumbnail->hqDefault . '">';
?>
@JackuB
JackuB / gist:2929733
Created June 14, 2012 11:24
Youtube video to div
<div id="video_container"></div>
<a href="bMvRdr-mUOU" class="vid_trigger">
<script type="text/javascript">
$('.vid_trigger').click( function(e){
e.preventDefault();
var URL = $(this).attr('href');
var htm = '<iframe width="615" height="460" src="http://www.youtube.com/embed/' + URL + '?autoplay=1&wmode=transparent" frameborder="0" allowfullscreen ></iframe>';