Skip to content

Instantly share code, notes, and snippets.

View rahims's full-sized avatar

Rahim Sonawalla rahims

View GitHub Profile
rahims / .vimrc
Created January 13, 2012 01:49
My .vimrc file.
set encoding=utf-8
set nobackup
set noswapfile
set nocompatible
set autoindent
set showcmd
set visualbell
set ignorecase
set smartcase
set ruler
rahims / get_notifications.php
Created July 28, 2011 21:18
Sample code that shows how to get all the notifications for your Twilio account
require 'Services/Twilio.php';
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN);
try {
$notifications = $client->account->notifications->getIterator();
rahims / handle-incoming-sms.php
Created July 22, 2011 20:55
Sample code on how to take an SMS and respond with an SMS based on what the person sent in
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
// When an SMS comes into your Twilio phone number, Twilio passes
// the body of the SMS to your web app in the Body parameter.
$keyword = strtolower(trim($_REQUEST['Body']));
rahims / handle-payment.php
Created June 1, 2011 06:34
Sample code that shows how to send an SMS message using Twilio whenever a payment is posted to one of your FreshBooks invoices. Read the full tutorial here:
// The Twilio helper library. Get a copy here:
// Uses the FreshBooks helper library written by Milan Rukavina. Get a copy
// here:
rahims / send.rb
Created May 4, 2011 06:42
Code to send an SMS using the Twilio API in Ruby. Written by Andrés Corvetto (not me, Rahim Sonawalla). Full blog post here:
require 'twiliolib'
# Twilio REST API version
API_VERSION = '2010-04-01'
# Twilio AccountSid and AuthToken
ACCOUNT_SID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ACCOUNT_TOKEN = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
FROM_ID = 'xxx-xxx-xxx';
class DB {
const DB_NAME = 'votes.sqlite';
protected $db;
function __construct() {
$this->db = new PDO('sqlite:'.self::DB_NAME);
rahims / group_therapy.php
Created November 14, 2010 09:21
Code from Twilio talk given at the L.A. Hacker News Meetup on 11/13/2010
* Code from Twilio talk given at the L.A. Hacker News Meetup on 11/13/2010
* During the talk, everyone was asked to vote (vote.php) whether they were
* awesome or not (text "1" for awesome, anything else for not awesome).
* Afterwards, the first person to vote was called up and told they were
* awesome. In this script, we call up the first person to vote that they're
* awesome and the first person to vote that they're not, in the hopes that
* the awesome person can help the not awesome person be awesome. Awesome,
rahims / callback.php
Created April 14, 2010 19:25
Example PHP code for working with the Netflix API using the OAuthSimple library.
// OAuthSimple can be found at
// You'll likely want to move $consumer_key and $consumer_secret to an
// include file
$consumer_key = '[The key given to you by Netflix]';
$consumer_secret = '[The shared secret given to you by Netflix]';
$oauth_token = $_GET['oauth_token'];