Skip to content

Instantly share code, notes, and snippets.

View jonkpirateboy's full-sized avatar

Johan Jonk Stenström jonkpirateboy

View GitHub Profile
@jonkpirateboy
jonkpirateboy / jquery-cookie-proxy.js
Created March 9, 2021 16:18
When you want to use js-cookie instead of jquery-cookie, but also use plugins requiring jquery-cookie. Or just lazy.
@jonkpirateboy
jonkpirateboy / Distraction Free YouTube
Last active November 28, 2016 07:34
Put the code in a browser button. If you click it when watching a YouTube-video, the video will open in a pop up. Disctraction free and perfect for watching videos while "working".
javascript:yturl=window.location.href;ytarr=yturl.split("?v=");ytqs=ytarr[1];ytqs=ytqs.replace("&","?");ytelem=document.getElementById("movie_player");yttime=Math.floor(ytelem.getCurrentTime());document.getElementsByTagName("video")[0].pause();if(ytqs.indexOf("?")>-1){ytqsstart="&"}else{ytqsstart="?"}window.open("https://www.youtube.com/embed/"+ytqs+ytqsstart+"autoplay=1&start="+yttime,ytqs,"width=400,height=300");void(0);
@jonkpirateboy
jonkpirateboy / import-members.php
Created November 13, 2016 14:03
Import members from csv-file to custom post type
<?php
/*
Plugin Name: CUSTOMER import members
Plugin URI: http://www.CUSTOMER.com/
Description: Import members from csv-file
Version: 1.0
Author: Follow me Darling
Author URI: http://followmedarling.se
*/
@jonkpirateboy
jonkpirateboy / sortbytaxonomy.php
Last active August 29, 2015 14:21
Sort by taxonomy
$timestamps = get_terms( 'timestamp', array(
'hide_empty' => true,
'orderby' => 'name',
) );
if ( ! empty( $timestamps ) && ! is_wp_error( $timestamps ) ){
echo '<ul>';
foreach ( $timestamps as $timestamp ) {
echo '<li>' . $timestamp->name . '</li>';
$args = array('post_type' => 'event',
'tax_query' => array(
@jonkpirateboy
jonkpirateboy / chooseimagesize.php
Last active August 29, 2015 14:19
Make custom image sizes chooseable from admin
function fmd_image_sizes() {
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'bigger_thumbnail', 300, 300, true ); //will be visible in admin
add_image_size( 'carousel', 1300, 380, true ); //will not be visible in admin
}
}
add_action( 'init', 'fmd_image_sizes' );
function fmd_chooseable_image_sizes( $sizes ) {
return array_merge( $sizes, array(
@jonkpirateboy
jonkpirateboy / functions.php
Last active August 29, 2015 14:15
Simple responsive images, jQuery
<?php
function fmd_child_setup() {
add_image_size( 'header', 1170, 400, true ); //(cropped)
add_image_size( 'mobileHeader', 750, 250, true ); //(cropped)
}
add_action( 'after_setup_theme', 'fmd_child_setup' );
?>
@jonkpirateboy
jonkpirateboy / fsdata-tinymce.php
Last active August 29, 2015 14:11
FS Data TinyMCE
<?php
/*
Plugin Name: FS Data TinyMCE
Plugin URI: http://followmedarling.se
Description: Plugin för att riktexteditorn TinyMCE ska funka på FS Data
Version: 1.0
Author: Jonk
Author URI: http://followmedarling.se
*/
define('SCRIPT_DEBUG', true);