Skip to content

Instantly share code, notes, and snippets.

View chrisblakley's full-sized avatar
⚔️
Take that, entropy!

Chris Blakley chrisblakley

⚔️
Take that, entropy!
View GitHub Profile
@chrisblakley
chrisblakley / google-maps-js-api.php
Created April 13, 2017 16:35
A too in-depth implementation of Google Maps JS API
<script>
jQuery(document).on('ready', function(){
mapInfo = [];
mapActions();
jQuery.getScript('https://www.google.com/jsapi?key=' + nebula.site.options.nebula_google_browser_api_key, function(){
google.load('maps', '3', {
callback: function(){
getAllLocations();
}
@chrisblakley
chrisblakley / once.js
Created February 21, 2016 17:27
A function that allows other functions to be called only one time per page load.
function once(fn, args, unique){
if ( typeof onces === 'undefined' ){
onces = {};
}
if ( typeof fn === 'function' ){ //If the first parameter is a function
if ( typeof args === 'string' ){ //If no parameters
args = [];
unique = args;
}
@chrisblakley
chrisblakley / admin_functions.php
Last active June 26, 2018 16:19
Business Hours Custom Field Group without ACF
<?php
//Add Open/Closed info to location listing columns
add_filter('manage_edit-location_columns', 'schc_location_hours_columns_head');
function schc_location_hours_columns_head($defaults){
$defaults['openclosed'] = 'Open/Closed';
return $defaults;
}
add_action('manage_location_posts_custom_column', 'schc_location_hours_columns_content', 15, 3);
function schc_location_hours_columns_content($column_name, $id){
if ( $column_name == 'openclosed' ){
@chrisblakley
chrisblakley / active_users_metabox.php
Last active February 12, 2022 10:11
Get data about active WordPress users on your site as well as list when they were last online.
<?php
/*==========================
This snippet shows how to add an active user count to the WordPress Dashboard.
Copy these contents to functions.php
===========================*/
//Active Users Metabox
add_action('wp_dashboard_setup', 'gearside_activeusers_metabox');
function gearside_activeusers_metabox(){
@chrisblakley
chrisblakley / event-intent-click.js
Last active November 7, 2015 18:01
Reduce the amount of speculation when making insights in Google Analytics by using context clues to determine the event intent from user interactions. https://gearside.com/event-intent-using-context-clues-determine-user-intention/
jQuery('a.some-link').on('mousedown tap touch', function(e){
eventIntent = ( e.which >= 2 )? 'Intent' : 'Explicit';
ga('set', 'dimension3', eventIntent);
ga('send', 'event', 'Category', 'Action', 'Label', 'Value');
});
@chrisblakley
chrisblakley / cloudflare-dev-mode.js
Created October 3, 2015 02:16
This is a more complete Cloudflare admin bar functionality. Can definitely be more optimized, but it gets the idea across.
function cloudflareDevModeToggle(toggle){
if ( !toggle ){
toggle = 'on';
}
jQuery('.devmodeicon').removeClass('fa-bolt fa-medkit').addClass('fa-spin fa-spinner');
jQuery.ajax({
type: "POST",
url: bloginfo["admin_ajax"],
@chrisblakley
chrisblakley / phone_emails.txt
Last active August 29, 2015 14:18
Mobile phone email addresses. This allows texting to a phone via email. Replace "5551234567" with the actual phone number (with area code).
AT&T: 5551234567@txt.att.net
Sprint: 5551234567@messaging.sprintpcs.com
T-Mobile: 5551234567@tmomail.net
Verizon: 5551234567@vtext.com
3 River Wireless: 5551234567@sms.3rivers.net
ACS Wireless: 5551234567@paging.acswireless.com
Alltel: 5551234567@message.alltel.com
AT&T: 5551234567@txt.att.net
@chrisblakley
chrisblakley / common_referral_spambots.txt
Last active November 6, 2016 23:33
Common referral spambots that appear in Google Analytics reports. More information on how to use this list: http://gearside.com/stop-spambots-like-semalt-buttons-website-darodar-others/
100dollars-seo.com
4webmasters.org
7makemoneyonline.com
aliexpress.com
anticrawler.org
best-seo-offer.com
best-seo-solution.com
bestwebsitesawards.com
blackhatworth.com
buttons-for-website.com
@chrisblakley
chrisblakley / trello_styles.css
Last active September 23, 2018 16:43
Custom CSS to enchance Trello.
/* Show the move cursor to demonstrate drag/drop scrolling on the interface. */
#board {
cursor: move;
}
#board .list {
cursor: default;
}
/* Change the background to a texture while maintaining board color. */