Skip to content

Instantly share code, notes, and snippets.

View chodorowicz's full-sized avatar

Jakub Chodorowicz chodorowicz

View GitHub Profile
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// mit license. paul irish. 2010.
// webkit fix from Oren Solomianik. thx!
// callback function is passed the last image to load
// as an argument, and the collection as `this`
<?php
/*
Description: Adds a taxonomy filter in the admin list page for a custom post type.
Written for: http://wordpress.stackexchange.com/posts/582/
By: Mike Schinkel - http://mikeschinkel.com/custom-workpress-plugins
Instructions: Put this code in your theme's functions.php file or inside your own plugin. Edit to suite your post types and taxonomies. Hope this helps...
*/
//
add_filter('manage_{custom_post_type_name}_posts_columns', 'add_custom_taxonomy_column');
@chodorowicz
chodorowicz / do_slugify_filename.js
Created November 17, 2011 21:52
Directory Opus JScript slugify/web-safe rename
@script jscript
function Rename::GetNewName2 ( strFileName, strFilePath, _fIsFolder, strOldName, strNewName ){
r = strFileName;
r = r.toLowerCase();
r = r.replace(new RegExp("[àáâãäåą]", 'g'),"a");
r = r.replace(new RegExp("[æ]", 'g'),"ae");
r = r.replace(new RegExp("[çčçć]", 'g'),"c");
r = r.replace(new RegExp("[èéěêëę]", 'g'),"e");
@chodorowicz
chodorowicz / image-shortcode.php
Created June 13, 2012 23:37 — forked from kovshenin/image-shortcode.php
Image shortcode for WordPress
<?php
/**
* Image shortcode callback
*
* Enables the [kovshenin_image] shortcode, pseudo-TimThumb but creates resized and cropped image files
* from existing media library entries. Usage:
* [kovshenin_image src="http://example.org/wp-content/uploads/2012/03/image.png" width="100" height="100" style="margin-top:10px" title="image title"]
*
* @uses image_make_intermediate_size
*/
@chodorowicz
chodorowicz / dabblet.css
Created February 28, 2013 11:36 — forked from anonymous/dabblet.css
Untitled
.wrapper:hover label{
background-position:left bottom;
}
label{
background:url('http://img833.imageshack.us/img833/5959/stard.png') no-repeat left bottom;
float:right;
line-height:20px;
padding-left:20px;
height:15px;
}
@chodorowicz
chodorowicz / index.html
Created March 22, 2013 22:30
A CodePen by Jakub Chodorowicz.
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Wing Chun Terms</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
@chodorowicz
chodorowicz / index.html
Created March 24, 2013 14:10
A CodePen by monolithpl.
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Wing Chun Terms</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
@chodorowicz
chodorowicz / index.html
Created March 24, 2013 14:10
A CodePen by monolithpl.
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Wing Chun Terms</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
.slider {
/* set initial width */
width: 520px;
/* hide the content that overflows (to allow second box to show through) */
overflow: hidden;
display: inline-block;
/* skew container so that it has angled edge, and set up transition */
transform: skewX(-20deg);
@chodorowicz
chodorowicz / get_translated_media_or_original.php
Last active March 30, 2017 08:50
get file media file in current language, if it doesn't exist get original version
<?php
if (!function_exists('get_translated_media_or_original')) {
function get_translated_media_or_original($media_file_id) {
global $wpdb;
// check language of media file
$custom_query = "SELECT * FROM ".$wpdb->postmeta." WHERE meta_key='wpml_media_lang' AND post_id=".$wpdb->escape($media_file_id);
$meta = $wpdb->get_results( $custom_query );
$media_file_language = $meta[0]->meta_value;
// if language of media file equals current language, return that id
if($media_file_language == ICL_LANGUAGE_CODE) {