Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home, as always

Ihor Vorotnov ihorvorotnov

🏠
Working from home, as always
Block or report user

Report or block ihorvorotnov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ihorvorotnov
ihorvorotnov / SnapshotCommand.php
Created Aug 6, 2019 — forked from ralphschindler/SnapshotCommand.php
An example Laravel app command to create and load database snapshots using S3
View SnapshotCommand.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class SnapshotCommand extends Command
{
@ihorvorotnov
ihorvorotnov / log.php
Last active Jun 29, 2017 — forked from evanre/log.php
Simple debug trace to wp-content/debug.log
View log.php
<?php
/**
* Simple debug trace to wp-content/debug.log
*
* @usage _log( $var );
*
* @param $log mixed A string|array|object you want to dump into wp-content/debug.log
*/
if ( ! function_exists( '_log' ) ) {
@ihorvorotnov
ihorvorotnov / wordpress-default.css
Created Nov 29, 2016 — forked from madalinignisca/wordpress-default.css
Default WordPress classes for using with CSS
View wordpress-default.css
/**
* Default Body Class Styles
*/
.rtl {}
.home {}
.blog {}
.archive {}
.date {}
.search {}
View remove_wrapping_p_tag.php
<?php
/**
* Move image inside <p> tag above the <p> tag while preserving any link around image.
* Can be prevented by adding any attribute or whitespace to <p> tag, e.g. <p class="yolo"> or even <p >
*/
function gc_remove_p_tags_around_images($content)
{
$contentWithFixedPTags = preg_replace_callback('/<p>((?:.(?!p>))*?)(<a[^>]*>)?\s*(<img[^>]+>)(<\/a>)?(.*?)<\/p>/is', function($matches)
{
/*
View keybase.md

Keybase proof

I hereby claim:

  • I am ihorvorotnov on github.
  • I am ihorvorotnov (https://keybase.io/ihorvorotnov) on keybase.
  • I have a public key whose fingerprint is A866 1403 6C25 E295 B6B4 CC47 C82E B589 1154 9391

To claim this, I am signing this object:

@ihorvorotnov
ihorvorotnov / render-taxonomy-tree.php
Created Apr 16, 2016 — forked from nmedia82/render-taxonomy-tree.php
Rendering Taxonomy Tree for custom post types in Wordpress Plugin or Theme as checkbox input
View render-taxonomy-tree.php
/**
* Following script will render Taxonomy Tree attached with specified post type
* in following example post_type use: books
* output can be seen here: https://www.diigo.com/item/image/4xv00/xrhq
*/
$posttype = 'books'
//getting all taxonomies with attached with $posttype
$taxonomy_names = get_object_taxonomies( $posttype );
View gist:857a9587fd33e1ba62cacf5187b5b0cd
[alias]
changelog = "!_() { t=$(git describe --abbrev=0 --tags); git log ${t}..HEAD --no-merges --pretty=format:'* %s'; }; _"
@ihorvorotnov
ihorvorotnov / gist:38c843e7b95e3336321d6d78fb55b2a1
Created Apr 9, 2016 — forked from johnbillion/hierarchy.php
WordPress Template Hierarchy (as of WordPress 4.4)
View gist:38c843e7b95e3336321d6d78fb55b2a1
<?php
/* WordPress Template Hierarchy as of WordPress 4.4
is_404() ---------------------------------------------------------------------------------------------------> 404.php
is_search() ------------------------------------------------------------------------------------------------> search.php
is_front_page() --------------------------------------------------------------------------------------------> front-page.php
is_home() --------------------------------------------------------------------------------------------------> home.php
@ihorvorotnov
ihorvorotnov / remove_hover_rule.js
Created Apr 5, 2016 — 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)
View remove_hover_rule.js
// 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 Mar 7, 2016 — 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.
View whatissoslow.php
<?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.
*
You can’t perform that action at this time.