Skip to content

Instantly share code, notes, and snippets.

View javorszky's full-sized avatar
🏠
Working from home

Gabor Javorszky javorszky

🏠
Working from home
View GitHub Profile
@javorszky
javorszky / wordpress-plugin-svn-to-git.md
Created July 11, 2017 12:47 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@javorszky
javorszky / create-wp-admin-account.sql
Created October 14, 2015 14:29 — forked from azizur/create-wp-admin-account.sql
Create a WordPress Administrator user account using SQL
USE __DATABASE__;
SET @username = 'azizur';
SET @password = MD5('password');
SET @fullname = 'Azizur Rahman';
SET @email = 'azizur@example.com';
SET @url = 'http://azizur.com/';
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`) VALUES (@username, @password, @fullname, @email, @url, NOW(), '0', @fullname);
$(document).ready(function(){
setInterval(countdomains(), 1000);
function countdomains(){
var cb;
$(".letters").each(function(){
cb = $(this);
$.getJSON("/api/domain/countByLetter?letter="+$(this).data('letter'), null, function(data){
cb.text(data);
});
});
@javorszky
javorszky / gist:7098185
Last active December 26, 2015 05:08 — forked from halfdan/gist:7098180
.designs/
wp-content/*
!wp-content/themes
wp-content/themes/**/node_modules
wp-content/themes/**/.sass-cache

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