Skip to content

Instantly share code, notes, and snippets.

View ihorvorotnov's full-sized avatar
🇺🇦
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🇺🇦
Working remotely since 1999
View GitHub Profile
@ihorvorotnov
ihorvorotnov / remove_hover_rule.js
Created April 5, 2016 20:06 — forked from rcmachado/remove_hover_rule.js
Remove CSS :hover rules for touch devices to avoid iOS double-tap behavior. Copied and adapted from http://retrogamecrunch.com/tmp/hover (just a fix for sheet.cssRules)
// disable :hover on touch devices
// based on https://gist.github.com/4404503
// via https://twitter.com/javan/status/284873379062890496
// + https://twitter.com/pennig/status/285790598642946048
// re http://retrogamecrunch.com/tmp/hover
// NOTE: we should use .no-touch class on CSS
// instead of relying on this JS code
function removeHoverCSSRule() {
if ('createTouch' in document) {
try {
@ihorvorotnov
ihorvorotnov / whatissoslow.php
Created March 7, 2016 23:06 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@ihorvorotnov
ihorvorotnov / phone-codes.php
Created February 9, 2016 23:49
Telephone codes by country
<?php
$countries = array();
$countries[] = array("code"=>"AF","name"=>"Afghanistan","d_code"=>"+93");
$countries[] = array("code"=>"AL","name"=>"Albania","d_code"=>"+355");
$countries[] = array("code"=>"DZ","name"=>"Algeria","d_code"=>"+213");
$countries[] = array("code"=>"AS","name"=>"American Samoa","d_code"=>"+1");
$countries[] = array("code"=>"AD","name"=>"Andorra","d_code"=>"+376");
$countries[] = array("code"=>"AO","name"=>"Angola","d_code"=>"+244");
$countries[] = array("code"=>"AI","name"=>"Anguilla","d_code"=>"+1");
$countries[] = array("code"=>"AG","name"=>"Antigua","d_code"=>"+1");
@ihorvorotnov
ihorvorotnov / nav_metabox.php
Last active February 3, 2016 18:42 — forked from johnmorris/gist:5221875
Custom metabox for navigation menus
if ( !class_exists('JMO_Custom_Nav')) {
class JMO_Custom_Nav {
public function add_nav_menu_meta_boxes() {
add_meta_box(
'wl_login_nav_link',
__('WishList Login'),
array( $this, 'nav_menu_link'),
'nav-menus',
'side',
'low'
@ihorvorotnov
ihorvorotnov / wp-translation-strings.php
Last active October 22, 2015 14:49
Complex translation strings in WordPress themes and plugins
<?php
/**
* The following is the proper way to handle complex translation strings.
* By Justin Tadlock
* @see https://wpchat.com/t/do-you-use-format-placeholders-s-and-d-in-translatable-strings/1138/11
*/
$number = get_donation_count();
$string = sprintf(
// translators: %s is the number of donations.
@ihorvorotnov
ihorvorotnov / gist:6e2acd9badecea2b0f77
Created September 30, 2015 15:15
Remove WP.org logo and links from toolbar
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
function remove_wp_logo( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
}
# Create a repository archive
# Format: git archive {branchname} --format={compression} --output={filename}
git archive master --format=tar --output=kuma.tar
git archive some-feature-branch --format=tar --output=kuma.tar
@ihorvorotnov
ihorvorotnov / full-image-quality.php
Last active September 20, 2015 20:51 — forked from raewrites/full-image-quality.php
Full Image Quality
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );
@ihorvorotnov
ihorvorotnov / .gitconfig
Last active September 20, 2015 14:04 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@ihorvorotnov
ihorvorotnov / index.html
Last active August 29, 2015 22:42 — forked from benschwarz/index.html
Using ARIA roles with <header>, <footer> and <aside>
<!doctype html>
<html>
<body>
<header role="banner">
<a href="/" rel="home">My company</a>
<nav role="navigation">
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
</header>