Skip to content

Instantly share code, notes, and snippets.

View noroot's full-sized avatar
🎯
Focusing

noroot noroot

🎯
Focusing
View GitHub Profile
@noroot
noroot / harwriter.py
Last active August 27, 2015 20:45 — forked from rouli/harwriter.py
A script to create a HAR file out of a mitmproxy's dump file
#!/usr/bin/env python
import binascii, sys, json
import version, tnetstring, flow
from datetime import datetime
def create_har(flows):
return {
"log":{
@noroot
noroot / NSString to BOOL
Created February 15, 2014 10:29
Cast NSString to BOOL in objective-c
BOOL boolValue = [myString boolValue];
@noroot
noroot / gist:10366783
Created April 10, 2014 10:39
OpenSSL TLS Heartbeat Extension exploit
# Exploit Title: [OpenSSL TLS Heartbeat Extension - Memory Disclosure - Multiple SSL/TLS versions]
# Date: [2014-04-09]
# Exploit Author: [Csaba Fitzl]
# Vendor Homepage: [http://www.openssl.org/]
# Software Link: [http://www.openssl.org/source/openssl-1.0.1f.tar.gz]
# Version: [1.0.1f]
# Tested on: [N/A]
# CVE : [2014-0160]
@noroot
noroot / gist:7764926571bd466fc400
Last active August 29, 2015 14:05
ExtJS 5 assiciations
Ext.define('MyApp.model.User', {
extend: 'MyApp.model.Base',
fields: [{
name: 'name',
type: 'string'
}]
});
Ext.define('MyApp.model.Post', {
@noroot
noroot / gist:212d8b8251bcdac0d27b
Last active August 29, 2015 14:05
ExtJS 5 Data Package: Validation
Ext.define('MyApp.model.User', {
extend: 'Ext.data.Model',
fields: ...,
validators: {
name: [
'presence',
{ type: 'length', min: 7 },
{ type: 'exclusion', list: ['Bender'] }
]
@noroot
noroot / gist:f094258eaa80e26a5ae3
Created August 16, 2014 07:47
ExtJS 5 ViewModel
Ext.define('TestViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.test', // connects to viewModel/type below
data: {
firstName: 'John',
lastName: 'Doe'
},
@noroot
noroot / cs.php
Last active August 29, 2015 14:05
cs
<?php
//bad
public function test($i,$test=0)
{
if($i=1){
echo $1;
foreach($a as $k) {
echo $k;
}
@noroot
noroot / summ.js
Created August 26, 2014 02:17
summ with undefined arguments
// variant 1
function oversum()
{
s = 0;
for (i in arguments)
{
x = arguments[i];
s+=x;
@noroot
noroot / app.js
Created August 31, 2014 18:59 — forked from niallo/app.js
var mailer = require('nodemailer')
var Hapi = require('hapi')
var util = require('util')
var template = require('swig')
var path = require('path')
var PORT = process.env.PORT || 8080
var server = new Hapi.Server(PORT)
template.init({

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