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
@belichuk
belichuk / test.php
Created April 15, 2015 12:12
PHP performance: function vs closures vs
<?php
$iter = 1000000;
$start = microtime(true);
function func($item) { return $item; };
for ($i = 0; $i < $iter; $i++)
{
func($i);
}
$end = microtime(true) - $start;
@johnbillion
johnbillion / hierarchy.php
Last active June 22, 2023 23:05
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
@bhubbard
bhubbard / gist:293ff7c81c453d505647
Created March 12, 2015 21:02
Delete all post revisions and their metadata
DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);
@tronsha
tronsha / installphp7.sh
Last active October 13, 2023 00:13
Install PHP7 to Ubuntu
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev make
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
public static function get_country_array() {
$countries = array(
'AF' => __( 'Afghanistan', 'yoast-local-seo' ),
'AL' => __( 'Albania', 'yoast-local-seo' ),
'DZ' => __( 'Algeria', 'yoast-local-seo' ),
'AS' => __( 'American Samoa', 'yoast-local-seo' ),
'AD' => __( 'Andorra', 'yoast-local-seo' ),
'AO' => __( 'Angola', 'yoast-local-seo' ),
'AI' => __( 'Anguilla', 'yoast-local-seo' ),
'AQ' => __( 'Antarctica', 'yoast-local-seo' ),
@discordier
discordier / gist:ed4b9cba14652e7212f5
Created December 4, 2014 06:23
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@roachhd
roachhd / README.md
Last active November 19, 2020 14:56
Ode To Dan : Quick switch Themes with javascript

A simple clone of Dan Edens' blog with the day/night persistent toggle ❤️

<script>
// Toggle night theme
var d = document.documentElement,
    t = document.querySelectorAll(".js--toggle-lights")[0],
    m = localStorage.getItem("nightmode");

if(m == "true") {
@nmedia82
nmedia82 / render-taxonomy-tree.php
Last active April 22, 2019 13:46
Rendering Taxonomy Tree for custom post types in Wordpress Plugin or Theme as checkbox input
/**
* 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 );
<?php
// Prefetch For Speed Up
function dns_prefetch() {
$prefetch = 'on';
echo "\n <!-- DNS Prefetching Start --> \n";
echo '<meta http-equiv="x-dns-prefetch-control" content="'.$prefetch.'">'."\n";
if ($prefetch != 'on') {