Skip to content

Instantly share code, notes, and snippets.

View abraham's full-sized avatar
thanks a latte

Abraham Williams abraham

thanks a latte
View GitHub Profile
@abraham
abraham / body.html
Created January 10, 2011 01:31
GitHub Anywhere example code
<!-- Place anywhere in the <body> of your page replacing :name with a GitHub username and :repo with a repository name -->
<a href='http://github.com/:name' class='github-anywhere github-anywhere-user' data-user=':name'>Follow :name on GitHub</a>
<a href='http://github.com/:name/:repo' class='github-anywhere github-anywhere-watch' data-user=':name' data-repo=':repo'>Watch :name/:repo on GitHub</a>
@abraham
abraham / avatar.php
Created November 20, 2010 09:50
Never have a broken Twitter avatar again
<?php
// Requires the TwitterOAuth library. http://github.com/abraham/twitteroauth
require_once('twitteroauth/twitteroauth.php');
// ACCESS_TOKEN and ACCESS_SECRET are only needed if you want the request to count against a specific users rate limit.
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET);
if(!empty($_REQUEST['screen_name']) {
// I'm using users/show but you could also use users/profile_image here.
$connection->get('users/show', array('screen_name' => $_REQUEST['screen_name']));
if($connection->http_code == 200) {
@abraham
abraham / gather.xml
Created October 22, 2010 22:29
Building phone menus with Twilio
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="/process.php" method="GET">
<Say>Please enter your account number, followed by the pound sign</Say>
</Gather>
<Say>We didn't receive any input. Goodbye!</Say>
</Response>
{
"history": [{
"short_url": "http://goo.gl/Sp8J",
"long_url": "http://app.apigee.com/console/apigee-console-snapshots-1285909200000_2ec49d92-fb23-4352-8ff2-3a7124df31dc/rendersnapshotview",
"creation_time": "2010-10-10T06:54:16.701+00:00",
"details": {
"two hours": {
"clicks": {
"short_url": 0,
"chart_url": "http://chart.apis.google.com/chart?cht\u003dlfi\u0026chd\u003ds:AAAAAAAAAAAAAAAAAAAAAAAA\u0026chds\u003d0.0,4.9E-324\u0026chs\u003d50x15\u0026chco\u003d287ff5"
@abraham
abraham / find.html
Created October 10, 2010 03:26
Add social media share links to your Blogger blog
<!-- Place share links here -->
<div class='post-header'>
@abraham
abraham / grid.css
Created September 30, 2010 06:47
Basic HTML5 template with jQuery and a simple grid
/* Source: http://www.webdesignerwall.com/tutorials/the-simpler-css-grid/ */
.container {
width: 978px;
margin: 0 auto;
}
.grid1, .grid2, .grid3, .grid4, .grid5, .grid6, .grid7, .grid8, .grid9, .grid10, .grid11 {
float: left;
margin-left: 30px;
}
.grid1 {
@abraham
abraham / followers.php
Created September 26, 2010 21:53
Quick script to get all of the followers for Twitter users.
<?php
// Require the TwitterOAuth library. http://github.com/abraham/twitteroauth
require_once('twitteroauth/twitteroauth.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET);
// Empty array that will be used to store followers.
$profiles = array();
// Get the ids of all followers.
$ids = $connection->get('followers/ids');
// Chunk the ids in to arrays of 100.
@abraham
abraham / update.php
Created September 22, 2010 17:18
Simple script to post a Tweet using XML and OAuth
<?php
// Download the latest version of http://github.com/abraham/twitteroauth/downloads
// Move twitteroauth.php and OAuth.php into this directory.
// Register an application at http://dev.twitter.com/apps.
// Get a user access token as described in http://dev.twitter.com/pages/oauth_single_token.
require_once('twitteroauth.php');
$connection = new TwitterOAuth('app consumer key', 'app consumer secret', 'my access token', 'my access token secret');
$connection->format = 'xml';
$status = $connection->post('statuses/update', array('status' => $message));
@abraham
abraham / bridgecode.php
Created September 10, 2010 05:51
Example code for getting an OAuth 1.0a access_token from Twitter @anywhere users.
<?php
// Download TwitterOAuth from http://github.com/abraham/twitteroauth.
require_once('twitteroauth/twitteroauth.php');
// Get consumer keys from http://dev.twitter.com/apps.
$consumer_key = '';
$consumer_secret = '';
$oauth_bridge_code = '';
@abraham
abraham / install.sh
Created September 8, 2010 04:02
user-data script to setup ec2 ubuntu servers
#!/bin/bash
set -e -x
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -y
tasksel install lamp-server
apt-get install git-core
echo "Please remember to set the MySQL root password!"