Skip to content

Instantly share code, notes, and snippets.

@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>';
@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: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: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 / gaben.js
Created January 2, 2014 15:25
Pokud tento skript spustíte v konzoli (F12 v Chrome) na této adrese: https://store.steampowered.com/account/ zjistíte, jak moc vás má Gaben rád...
var radky = jQuery(".transactionRowPrice");
var pole = [];
jQuery.each(radky, function(i) {
if (radky.eq(i).text() != "Zdarma" && radky.eq(i).text() != "Není k dispozici" && radky.eq(i).text() != "Celkem") {
var cislo = radky.eq(i).text().replace(",", ".").replace("€", "").replace("--", "00");
if (!isNaN(cislo)) {
pole.push(parseInt(cislo, 10));
}
}
});
@JackuB
JackuB / FBcanvasSmoothScroll.js
Created April 9, 2014 09:20
FB.canvas.scrollTo + jQ animate()
function canvasSmoothScroll(y, d){
var duration = d || 800;
FB.Canvas.getPageInfo(function(pageInfo){
$({y: pageInfo.scrollTop}).animate(
{y: y},
{duration: duration, step: function(offset){
FB.Canvas.scrollTo(0, offset);
}
});
});
### Keybase proof
I hereby claim:
* I am jackub on github.
* I am jakub (https://keybase.io/jakub) on keybase.
* I have a public key whose fingerprint is D597 FB29 E275 6723 9842 A5E4 6D37 8129 AF31 AE0C
To claim this, I am signing this object:
@JackuB
JackuB / keybase.md
Created February 27, 2015 15:08
keybase.md

Keybase proof

I hereby claim:

  • I am jackub on github.
  • I am jakub (https://keybase.io/jakub) on keybase.
  • I have a public key whose fingerprint is 36C9 E4B3 BB33 C4BE 00E7 C432 29EC B5EC 0E4E FFF9

To claim this, I am signing this object:

@JackuB
JackuB / keybase.md
Created September 1, 2015 11:29
keybase.md

Keybase proof

I hereby claim:

  • I am jackub on github.
  • I am jakub (https://keybase.io/jakub) on keybase.
  • I have a public key whose fingerprint is 581E C602 345D 1B28 6703 D625 8D51 ABF8 EC29 C239

To claim this, I am signing this object:

@JackuB
JackuB / anvm.sh
Created November 16, 2015 09:48
anvm
#!/usr/bin/env bash
anvm () {
if [[ ! -f package.json ]] ; then
echo "No package.json found in current directory"
return 1
fi
local NVM_VERSION_DIR
local NODE_VERSION=$(cat package.json | jq '.engines.node' | tr -d '"')