Skip to content

Instantly share code, notes, and snippets.

# Install apt-get packages:
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
# Install chruby:
cd
wget https://github.com/downloads/postmodern/chruby/chruby-0.2.3.tar.gz
tar -xzvf chruby-0.2.3.tar.gz
cd chruby-0.2.3
sudo make install

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

@ismaelga
ismaelga / LICENSE
Last active August 29, 2015 14:06 — forked from ktheory/LICENSE
Copyright 2014 Kickstarter, Inc.
Released under an MIT License.
In celebration of Whyday: Rubyists always want to show others the beautiful code
they have created, hence the question: Has Anybody Seen My Code?
Has Anybody Seen My Code
(sung to the tune of Has Anybody Seen My Gal)
Clean and small, works for all,
Ruby is my all in all.
Has anybody seen my code?
from redis import Redis
import simplejson
class Resque(object):
"""Dirt simple Resque client in Python. Can be used to create jobs."""
redis_server = 'localhost:6379'
def __init__(self):
host, port = self.redis_server.split(':')
self.redis = Redis(host=host, port=int(port))
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@ismaelga
ismaelga / gist:8116261
Last active January 1, 2016 08:09 — forked from RiANOl/gist:1077760
require "openssl"
require "digest"
def aes128_encrypt(key, data)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.update(data) + aes.final
end
@ismaelga
ismaelga / pr.md
Created June 21, 2013 17:52 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: