Skip to content

Instantly share code, notes, and snippets.

Max maxchirkov

  • Phoenix, Arizona
Block or report user

Report or block maxchirkov

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
@maxchirkov
maxchirkov / dump-wp-hooks.php
Last active Nov 26, 2018
Dumps WP Hooks (Filters and Actions) in the order of execution in Markdown format.
View dump-wp-hooks.php
/**
* Dumps WP Hooks (Filters and Actions)
* in the order of execution in Markdown format.
*
* File hooks.md in the root location of the WP setup.
*
* @param bool $actions - render actions
* @param bool $filters - render filters
* @param bool $unique - render unique hooks
*/
View gist:12e21726eec6275db617b77c315e3bd1
/**
* All Area Widgets
*
* Parameters:
* @param data-init string widgets/area
* @param data-id string Area ID
* @param data-chooser boolean Render Chooser true|false
* @param data-chooser-limit number of items to be returned within the chooser
* @param data-widgets JSON Array '["age", "cost", "education", "employment",
* "occupancy", "summary", "weather", "details"]'
@maxchirkov
maxchirkov / widget_mapper.php
Last active Aug 29, 2015
Widgets Mapper from previous to the current theme
View widget_mapper.php
<?php
add_action('after_setup_theme', 'mapThemeWidgets');
function mapThemeWidgets()
{
$theme_slug = 'twentytwelve';
// Hash of old to new sidebar IDs
$map = array(
'sidebar-1' => 'hjitw-right-widgets',
'sidebar-2' => 'hjitw-footerwidgets'
@maxchirkov
maxchirkov / gist:e586683bd21614adc0b5
Created Jul 28, 2014
Neighborhood data based on listing
View gist:e586683bd21614adc0b5
<?php
add_action('the_content', 'demographics');
function demographics($content)
{
global $post;
if (!isset($post->listing))
return $content;
View .gitignore
# PHP Storm #
###############
.idea
.idea/*
# FROM: https://gist.github.com/octocat/9257657
# Compiled source #
###################
*.com
@maxchirkov
maxchirkov / new_gist_file
Created Apr 2, 2013
Resolving conflicts by accepting "theirs" version of the file.
View new_gist_file
http://stackoverflow.com/questions/161813/how-do-i-fix-merge-conflicts-in-git#3407920
@maxchirkov
maxchirkov / jquery-ui-tabs
Created Feb 16, 2012
jQuery UI Tabs Test
View jquery-ui-tabs
<?php
if(isset($_GET['q']))
die($_GET['q']);
?>
<html>
<head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/base/jquery-ui.css" type="text/css" media="all" />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js'></script>
@maxchirkov
maxchirkov / http_xml()
Created Jan 26, 2012
HTTP XML Request
View http_xml()
<?php
/**
* Simple HTTP request for API usage - converts XML into object
*/
function http_xml($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@maxchirkov
maxchirkov / re-queue
Created Dec 20, 2011
re-queue javascript in WP with a different handle
View re-queue
/** re-queue Google Maps script in Simple Real Estate Pack
* under different handle to avoid conflicts with other plugins
*/
add_action('wp_print_styles', 'custom_script_requeue');
function custom_script_requeue(){
//check if Simple Real Estate Pack's function that registeres the script exists
if( !function_exists('srp_default_headScripts') )
return;
//dequeue Google Maps script with "google" handle
@maxchirkov
maxchirkov / whitelist-alert
Created Aug 26, 2011
Alerts users to whilte-list your email address whenever they submit a form. Alerts could be customized to appear for only selected domain names like aol.com, earthlink.net etc.
View whitelist-alert
//Script assumes that you have jQuery loaded. Most WordPress themes do.
jQuery(document).ready(function(){
//Check email addresses
//All domains have to be be lower case
var check_emails = new Array("earthlink.net", "aol.com");
var email_warning = "Please make sure to white-list our email address test@test.com so it doesn't get stuck in your SPAM folder.";
var form_selector = 'form'; //change to '#form_id' - to apply to a specific form ID.
jQuery(form_selector).submit(function(){
jQuery('input').each(function(){
//check if form field values contain @ - we assume that's email address
You can’t perform that action at this time.