Skip to content

Instantly share code, notes, and snippets.

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

Rachid rachidify

🏠
Working from home
View GitHub Profile
@rachidify
rachidify / launch.json
Last active November 10, 2018 13:58
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/client",
"runtimeExecutable": "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
"userDataDir": "${workspaceRoot}/.vscode/chrome"
@rachidify
rachidify / coverage.js
Created February 27, 2018 11:49 — forked from ebidel/coverage.js
CSS/JS code coverage during lifecycle of page load
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*
* Shows how to use Puppeeteer's code coverage API to measure CSS/JS coverage across
* different points of time during loading. Great for determining if a lazy loading strategy
* is paying off or working correctly.
*
* Install:
* npm i puppeteer chalk cli-table
@rachidify
rachidify / init.vim
Last active September 13, 2018 20:36
~/.config/nvim/init.vim
call plug#begin('~/.vim/plugged')
Plug 'sheerun/vim-polyglot'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tyrannicaltoucan/vim-quantum'
Plug 'scrooloose/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'vim-syntastic/syntastic'
Plug 'editorconfig/editorconfig-vim'
@rachidify
rachidify / .vimrc
Last active September 16, 2018 19:20
.vimrc
set nu
syntax enable
set background=dark
set termguicolors
set shiftwidth=2
set expandtab
set tabstop=2
set nobackup
set nowritebackup
@rachidify
rachidify / .block
Last active September 13, 2017 22:34
fresh block
license: mit
@rachidify
rachidify / gist:b5bc98ef5121492fe2ef8d69efb0c036
Last active October 10, 2017 21:33
HTML5 push state + nginx
server {
listen 80;
set $host_path "www/***";
root $host_path;
index index.html;
location ~ ^/.+/$ {
rewrite .* /index.html last;
}
docker run -it --rm --name letsencrypt -v "/etc/letsencrypt:/etc/letsencrypt" -v "/var/lib/letsencrypt:/var/lib/letsencrypt" -v /tmp/letsencrypt:/tmp/letsencrypt quay.io/letsencrypt/letsencrypt:latest auth -a webroot --webroot-path /tmp/letsencrypt -d
docker run -it --rm --name letsencrypt \
-v "/Users/rasheedhamdawi/lets_encrypt/etc:/etc/letsencrypt" \
-v "/Users/rasheedhamdawi/lets_encrypt/lib:/var/lib/letsencrypt" \
quay.io/letsencrypt/letsencrypt:latest \
--agree-dev-preview \
--server https://acme-v01.api.letsencrypt.org/directory \
-a manual \
auth
declare module 'relay-runtime' {
const RecordSource: any;
const Store: any;
const Network: any;
const Environment: any;
}
@rachidify
rachidify / start.html
Last active August 29, 2015 14:17 — forked from imranomari/start.html
<!DOCTYPE html>
<html lang="en" class="no-js" itemscope itemtype="http://schema.org/WebPage">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, width=device-width, initial-scale=1">
<title>[PageTitle]</title>
<!-- SEO Meta -->

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