Skip to content

Instantly share code, notes, and snippets.

View chodorowicz's full-sized avatar

Jakub Chodorowicz chodorowicz

View GitHub Profile
<?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
*/
var BrowserDetector = (function() {
var exports = {};
exports.isChrome = navigator.userAgent.indexOf('Chrome') > -1;
exports.isExplorer = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
exports.isFirefox = navigator.userAgent.indexOf('Firefox') > -1;
exports.isSafari = navigator.userAgent.indexOf("Safari") > -1;
exports.isOpera = navigator.userAgent.toLowerCase().indexOf("op") > -1;
if ((exports.isChrome)&&(exports.isSafari)) {exports.isSafari=false;}
if ((exports.isChrome)&&(exports.isOpera)) {exports.isChrome=false;}
@chodorowicz
chodorowicz / gist:77db61059b7238717233
Created December 8, 2015 12:30
check position on input number
const arrowCodesVertical = [38, 40];
const arrowCodesHorizontal = [37, 39];
console.log(event.keyCode);
// console.log(this.myTextInput);
let s = window.getSelection();
let len = s.toString().length;
let isLeftEdge, isRightEdge;
s.modify('extend', 'backward', 'character');
if (len < s.toString().length) {
// It's not at the beginning of the input, restore previous selection
@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);