Skip to content

Instantly share code, notes, and snippets.

@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

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

@Belphemur
Belphemur / transmission-ssl
Last active June 28, 2024 08:41
Configuration to use nginx as reverse proxy for Transmission BT with SSL/HTTP2 protected with auth
upstream transmission {
server 127.0.0.1:9091; #Transmission
}
server {
listen 443 ssl http2;
server_name example.com;
auth_basic "Server Restricted";
auth_basic_user_file /var/www/myWebSite/web/.htpasswd;
# Path to the root of your installation
# Before Script
before_script:
- composer self-update
- composer install --prefer-dist > /dev/null
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh
# Services
services:
@richard-wolsch
richard-wolsch / convert-fpdf-form.php
Last active December 19, 2022 11:05
Preprocess a PDF form to fill it with FPDF: This will give unique names to all fields, flip checkbox options (yes needs to be before no) and makes all fields readonly.
<?php
echo "\e[32mConvert the form in a PDF to be used by FPDF. This will rename all form fields.\e[39m\n";
$filename = readline("PDF Path: ");
$content = file_get_contents($filename);
// ==== TASK 1 ====
// Find all text input fields and give them unique names.
// Solves: PDF forms are sometimes organized in groups where a form field has children (“/Kids”). Children of different
// groups could have the same field names. FPDF can't handle that.
@sergix44
sergix44 / deploy.sh
Last active May 15, 2024 00:45
Laravel deployment script
#!/usr/bin/env sh
# default: deploy from master branch
_BRANCH=${1:-master}
# php binary
_PHP=${2:-php8.2}
# path to composer
_COMPOSER=${3:-~/.composer/composer}