This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// there is a solution for jQuery < 1.9.0, where you can use `$.browser`: | |
// https://gist.github.com/nathansmith/950767 | |
// but jQuery removed `$.browser` in version 1.9.0, so you have to get another way: | |
function last_child() { | |
if (/msie [1-8]{1}[^0-9]/.test(navigator.userAgent.toLowerCase())) { | |
$('*:last-child').addClass('last-child'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("input[type=number]").keydown(function(event) { | |
// Allow: backspace, delete, tab, escape, enter and . | |
if ( $.inArray(event.keyCode,[46,8,9,27,13,190]) !== -1 || | |
// Allow: Ctrl+A | |
(event.keyCode == 65 && event.ctrlKey === true) || | |
// Allow: home, end, left, right | |
(event.keyCode >= 35 && event.keyCode <= 39)) { | |
// let it happen, don't do anything | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if (/\bMSIE 6/.test(navigator.userAgent) && !window.opera) { | |
document.documentElement.className+=' ie6'; | |
} else if (navigator.appVersion.indexOf("MSIE 7.") != -1) { | |
document.documentElement.className+=' ie7'; | |
} else if (navigator.appVersion.indexOf("MSIE 8.") != -1) { | |
document.documentElement.className+=' ie8'; | |
} else if (navigator.appVersion.indexOf("MSIE 9.") != -1) { | |
document.documentElement.className+=' ie9'; | |
} else if (/*@cc_on!@*/false && document.documentMode === 10) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Based on | |
* - EGM Mathematical Finance class by Enrique Garcia M. <egarcia@egm.co> | |
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1) | |
*/ | |
var ExcelFormulas = { | |
PVIF: function(rate, nper) { | |
return Math.pow(1 + rate, nper); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm --cached -r src/dependencies/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ setxkbmap -option apple:badmap | |
# Place that command into ~/.bashrc file to have it run automatically when you log in. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'add_meta_boxes', 'custom_meta_boxes' ); | |
add_action( 'save_post', 'ExtraImageProperty_save' ); | |
function custom_meta_boxes() { | |
add_meta_box('ExtraImageProperty', 'Extra Image Property', 'ExtraImageProperty', 'page'); | |
} | |
function ExtraImageProperty() { | |
global $post; | |
$extra_image_url = get_post_meta($post->ID, 'extra_image_url', true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_attachment_id_from_src ($src) { | |
global $wpdb; | |
$reg = "/-[0-9]+x[0-9]+?.(jpg|jpeg|png|gif)$/i"; | |
$src1 = preg_replace($reg,'',$src); | |
if($src1 != $src){ | |
$ext = pathinfo($src, PATHINFO_EXTENSION); | |
$src = $src1 . '.' .$ext; | |
} | |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$src'"; | |
$id = $wpdb->get_var($query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.PointerEvent ? "pointer" : "ontouchstart" in window ? "touch" : "mouse"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar -c --bzip2 -f foo.tar.bz1 foo/ |
OlderNewer