Skip to content

Instantly share code, notes, and snippets.

View harisenbon's full-sized avatar

Keith Perhac harisenbon

View GitHub Profile
@harisenbon
harisenbon / functions.php
Created April 7, 2025 15:21
Elementor Empty Dynamic Field Condition
/**
* Load our override of dynamic-tags-condition
*/
add_action( 'elementor/display_conditions/register', function( $conditions_manager ) {
require_once(get_template_directory() . '/inc/elementor/seg-dynamic-tags-condition.php' );
$conditions_manager->register_condition_instance( new \Seg_Dynamic_Tags_Condition() );
} );
@harisenbon
harisenbon / bottom.js
Created January 10, 2017 17:00
Creating an EG Webinar Page using Lead Pages Default Design
/**
* Set the countdown date in line 11, and the script will automatically update the countdown timer as well as the text on the page.
*
**/
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.11/moment-timezone-with-data-2010-2020.min.js"></script>
<script type="text/javascript">
jQuery(function(){
// Set Date for this (next) monday at 5pm PST
@harisenbon
harisenbon / paralax.html
Created June 1, 2016 04:47
Simple Paralax Effect from SocialTriggers.com
<style>
.parallax-zone [data-parallax] {
will-change: transform;
}
</style>
<section class="jumbotron cover parallax-zone">
<div class="cover-wrapper">
<img data-parallax="0.6" src="/images/home/web.png" alt="web" class="web-image blend-overlay ">
<img data-parallax="-0.4" src="/images/home/social.png" alt="social" class="social-image blend-overlay">
@harisenbon
harisenbon / script.js
Created May 19, 2016 21:02
JS: Fill Out UTM Values into an infusionsoft Form
<script>
$(function(){
setFormValue('inf_custom_UTMCampaign', getQueryVal('utm_campaign'));
setFormValue('inf_custom_UTMMedium', getQueryVal('utm_medium'));
setFormValue('inf_custom_UTMSource', getQueryVal('utm_source'));
setFormValue('inf_custom_UTMContent', getQueryVal('utm_content'));
setFormValue('inf_custom_UTMTerm', getQueryVal('utm_term'));
setFormValue('inf_custom_UTMReferurl',document.referrer);
function getQueryVal(name) {
@harisenbon
harisenbon / appearance.css
Created October 13, 2015 04:56
Amazing iSoft Order Forms
@import "https://s3.amazonaws.com/BUCKET/webfonts/ss-gizmo.css";
/* Layout: Two Column
Theme: Basic Grey
Appearance.css contains the costmetic properties for your order
form, such as fonts, colors, background images and borders.
NOTE: There are additional classes that are not listed here
because they currently have no attributes. You can locate
these by downloading and using Firebug.
@harisenbon
harisenbon / name-filter.php
Created September 16, 2015 05:43
Detect names as Japanese or Western
<?php
/**
* Filter for determining of a csv of names is a Japanese name in romaji
* php name-filter.php ~/Desktop/names.csv`
*
* right now it returns the name and a 1 if it looks Japanese for easy verification, but it’s easy to switch that to the actual line of data
* right now it requires that both the first and last name look Japanese, so it fails on people like Yumiko who are Japanese with western last names
*
*/
@harisenbon
harisenbon / gist:84af1022cc49340186f8
Created September 5, 2014 00:18
Detect if domain uses Gapps for email
<?php
// Determine if this is a Google-hosted account
$isGoogle = false;
if(!empty($_GET['inf_field_Email'])){
list($name, $domain) = explode('@', urldecode($_GET['inf_field_Email']));
if($domain == 'gmail.com'){
$isGoogle = true;
} elseif(getmxrr($domain, $mxHosts)){
foreach($mxHosts as $mx){
if(stripos($mx, 'google') !== false){ $isGoogle = true; }
@harisenbon
harisenbon / gist:8f4ed87ea865cc58e3d4
Created August 15, 2014 04:36
Creating a Descender (drop cap) in CSS
From the NYT Site:
.descender:first-letter {
font-family: "neutra-face-text","Helvetica Neue",Helvetica,Segoe,"Segoe UI","Segoe WP",Calibri,Arial,clean,sans-serif;
font-weight: bold;
font-size: 60px;
font-size: 6rem;
line-height: 10px;
line-height: 1rem;
margin-right: 2px;
@harisenbon
harisenbon / norightclicking.js
Created August 7, 2014 08:35
Prevent Selection or right-clicking on content
(function($){
$.fn.disableSelection = function() {
return this
.attr('unselectable', 'on')
.css('user-select', 'none')
.on('selectstart', false);
};
$('body').disableSelection();
$("body").bind("contextmenu",function(e){
return false;

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter