Skip to content

Instantly share code, notes, and snippets.

View maxchirkov's full-sized avatar

Max maxchirkov

  • Phoenix, Arizona
View GitHub Profile
maxchirkov / whitelist-alert
Created August 26, 2011 19:28
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, etc.
//Script assumes that you have jQuery loaded. Most WordPress themes do.
//Check email addresses
//All domains have to be be lower case
var check_emails = new Array("", "");
var email_warning = "Please make sure to white-list our email address 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.
//check if form field values contain @ - we assume that's email address
maxchirkov / re-queue
Created December 20, 2011 15:41
re-queue javascript in WP with a different handle
/** 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') )
//dequeue Google Maps script with "google" handle
maxchirkov / http_xml()
Created January 26, 2012 18:08
HTTP XML Request
* 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 / jquery-ui-tabs
Created February 16, 2012 23:27
jQuery UI Tabs Test
<link rel="stylesheet" href="" type="text/css" media="all" />
<script type='text/javascript' src=''></script>
<script type='text/javascript' src=''></script>
maxchirkov / new_gist_file
Created April 2, 2013 22:02
Resolving conflicts by accepting "theirs" version of the file.
maxchirkov / .gitignore
Last active August 29, 2015 14:00 — forked from octocat/.gitignore
# PHP Storm #
# Compiled source #
maxchirkov / gist:e586683bd21614adc0b5
Created July 28, 2014 18:10
Neighborhood data based on listing
add_action('the_content', 'demographics');
function demographics($content)
global $post;
if (!isset($post->listing))
return $content;
maxchirkov / widget_mapper.php
Last active August 29, 2015 14:13
Widgets Mapper from previous to the current theme
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'
* 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 / dump-wp-hooks.php
Last active November 26, 2018 14:37
Dumps WP Hooks (Filters and Actions) in the order of execution in Markdown format.
* Dumps WP Hooks (Filters and Actions)
* in the order of execution in Markdown format.
* File in the root location of the WP setup.
* @param bool $actions - render actions
* @param bool $filters - render filters
* @param bool $unique - render unique hooks