Skip to content

Instantly share code, notes, and snippets.

View afbora's full-sized avatar
🎯
Focusing

Ahmet Bora afbora

🎯
Focusing
View GitHub Profile

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

@afbora
afbora / dynamic_colspan.js
Last active February 12, 2019 10:24
Dynamic Colspan / Colspan All Columns on Bootstrap Sample
$(function() {
jQuery.fn.exists = function(){return this.length>0;}
// Dynamic Colspan
if($('[colspan="auto"]').exists())
{
$.each($('[colspan="auto"]'), function( index, value ) {
var table = $(this).closest('table'); // Get Table
var siblings = $(this).closest('tr').find('th:visible, td:visible').not('[colspan="auto"]').length; // Count colspan siblings
@afbora
afbora / .htaccess
Last active June 16, 2019 18:49
Amazing htaccess with cache resources
# Amazing .htaccess
# Requires Following Modules Enabled
# mod_rewrite
# mod_deflate
# mod_headers
# mod_mime
# mod_expires
# rewrite rules
@afbora
afbora / filelist.php
Created April 10, 2019 07:28
Script to get list of files and file comparison
<?php
/**
* Script to get list of files and file comparison
*
* @version 2014.04.28
* @author Fedik <getthesite at gmail dot com>
* @link http://www.getsite.org.ua
* @license GNU/GPL http://www.gnu.org/licenses/gpl.html
*/