Skip to content

Instantly share code, notes, and snippets.

View mgrouchy's full-sized avatar

Mike Grouchy mgrouchy

View GitHub Profile
{
"bold_folder_labels": true,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"draw_white_space": "all",
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
@mgrouchy
mgrouchy / gist:3840754
Created October 5, 2012 16:09 — forked from jonathanmoore/gist:2640302
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

from django.shortcuts import render
def view(request):
form = FormClass()
return render(request, 'formpage.html', RequestContext(request, {'form': form}))
@mgrouchy
mgrouchy / OAuth.md
Created July 24, 2012 12:21
OAuth and API Providers: Come on guys.

The more OAuth providers there are, the more inconsistency there is. Not following the specification puts an increased and unnecessary burden on the developer.

In the past couple of weeks I have coordinated and authenticated with more than my fair share of OAuth providers. That being said, you should be thinking "hey isn't OAuth a specification?" Once you do one you should be simply swapping out keys and urls and you should be good to go right? So wrong.

Follow the specification and be consistent.

This article is meant to let the OAuth providers know some on the pain points of dealing with them as providers and things they could to make interacting with their API a joy.

API Documentation

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

class AttrDict(dict):
"""override dict class so we can access attributes using 'dot' notation
ex/ dict.value
"""
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
self.__dict__ = self
def __getstate__(self):
return self
@mgrouchy
mgrouchy / .tmux.conf
Created May 30, 2012 13:39
Tmux config
# Ctrl-a is a more comfortable prefix
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Mouse stuff
setw -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on
setw -g mouse-resize-pane on
require 'formula'
class TmuxForIterm2 < Formula
url 'http://iterm2.googlecode.com/files/tmux-for-iTerm2-20120108.tar.gz'
md5 'f15d9f567b9b029482bb7b3227ee7ac3'
homepage 'http://code.google.com/p/iterm2/wiki/TmuxIntegration'
depends_on 'libevent'
def install
@mgrouchy
mgrouchy / gist:2644916
Created May 9, 2012 14:33
Install Vim with +Python and +Ruby with Homebrew
brew install https://raw.github.com/gist/2051422/6b9f33b7135f44e3e55af6e15ed32b738de2f666/vim.rb
@mgrouchy
mgrouchy / installmercurial.sh
Created May 9, 2012 14:25
Install Mercurial
#install mercurial
easy_install mercurial
#or
pip install mercurial