Skip to content

Instantly share code, notes, and snippets.

@nhahv
nhahv / gist:e125c1f694204e5e8741
Last active August 29, 2015 14:18 — forked from jonathanmoore/gist:2640302
Share Count

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

@nhahv
nhahv / README.md
Last active August 29, 2015 14:18 — forked from evandrix/README.md

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@nhahv
nhahv / file2.php
Last active August 29, 2015 14:20 — forked from cstipkovic/formatDate.js
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 13/05/2015
* Time: 9:18 SA
*/
namespace App\Services;
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
#
# Requirements:
# =============
# PHP 5.4
#~/.local/share/applications/mimeapps.list
[Added Associations]
#...
x-scheme-handler/subl=subl-urlhandler.desktop
@nhahv
nhahv / HTMLEditorCustomizationSample.java
Last active February 24, 2021 14:42 — forked from jewelsea/HTMLEditorCustomizationSample.java
Customize the JavaFX HTMLEditor
import java.util.List;
import java.util.regex.Pattern;
import javafx.application.*;
import javafx.collections.FXCollections;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.web.HTMLEditor;
@nhahv
nhahv / CatchAllOptionsRequestsProvider.php
Created October 6, 2015 04:30 — forked from danharper/CatchAllOptionsRequestsProvider.php
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@nhahv
nhahv / laravel-mongodb-sentinel
Created October 10, 2015 07:07 — forked from Bodom78/laravel-mongodb-sentinel
Use the Sentinel 2.x authentication package with Laravel 5.1 and MongoDB
Work in Progress: More testing to be done.
At a glance Authentication, Activation, Throttle, Groups & Permissions seem to
be working.
Downside: Copy and modify files.
Upside: Not really much work to get it up and running.
Assumes you have Laravel 5.1, jenssegers/laravel-mongodb + session addon set up
and your app is namespaced to App/
@nhahv
nhahv / elasticsearch.yml
Created October 29, 2015 07:44 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@nhahv
nhahv / FontFix_RubyMine.md
Last active November 29, 2015 06:38 — forked from leemour/FontFix RubyMine
Fixing font anti-aliasing for Ubuntu.

Change Java Runtime:

sudo update-alternatives --config java

Delete Open-JDK

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*