Skip to content

Instantly share code, notes, and snippets.

@adatta02
adatta02 / rssToEmailCraigslist.php
Created July 25, 2011 03:26
Craigslist RSS to email
<?php
/****
* Little PHP script to hit Craigslist RSS feeds, check new posts, and shoot you an email with them.
* Good for finding things ;)
* REQUIRES http://code.google.com/p/phpquery/
****/
function resultsSort($a, $b) {
if ( count($a["posts"]) == count($b["posts"]) ) { return 0; }
@adatta02
adatta02 / jquery.confirm.js
Created July 25, 2011 03:33
quick n dirty jQuery UI confirm() dialogs
jQuery.confirm = function(options){
var opts = jQuery.extend( { message: "", ok: function(){}, cancel: function(){ } }, options );
jQuery("<div class=\"span-10\">
<div class=\"ui-confirm-message\">"
+ opts.message + "<img class=\"loader\" style=\"padding-left: 10px\" src=\"/images/loader.gif">\"</div></div>").dialog({
autoOpen: true,
modal: true,
autoOpen: false,
@adatta02
adatta02 / tru.ly_post_sample.txt
Created October 19, 2011 23:43
tru.ly social API POST sample
Content-Type: application/x-www-form-urlencoded
Content-Length: 295
data=%7B%22first_name%22%3A%22Joe%22%2C%22last_name%22%3A%22Sixpack%22%2C%22email%22%3A%22joesixpack%40tru.ly%22%2C%22birthday%22%3A%221%5C%2F1%5C%2F1990%22%2C%22zip_code%22%3A%2202139%22%2C%22truly_verified%22%3Atrue%7D&signature=45bbd5c59e59400c59b820857cbfe0118365b769cfa3ecf91663dbf9cfc0158a
@adatta02
adatta02 / tru.ly_decodesocial.php
Created October 19, 2011 23:44
tru.ly social API PHP sample
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$sig = urldecode( $_REQUEST["signature"] );
$data = urldecode( $_REQUEST["data"] );
// TODO: REPLACE THIS WITH YOUR SECRET
$secret = "9ffd989277b2058efe0542aff08c9301dc9fd9ce";
$expected_sig = hash_hmac('sha256', $data, $secret, false);
@adatta02
adatta02 / social_sample.json
Created October 19, 2011 23:53
tru.ly social JSON sample
{
"first_name":"Johnny",
"last_name":"Rico",
"email":"[email protected]",
"birthday":"1/1/1958",
"zip_code":"02142",
"truly_verified":true
}
@adatta02
adatta02 / services.yml
Created November 1, 2011 03:40
sext du jour services.yml
parameters:
twilio_app_id: MY_ID
twilio_token: MY_TOKEN
twilio_number: MY_REGISTERED_NUMBER
services:
twilio:
class: Services_Twilio
arguments: [%twilio_app_id%, %twilio_token%, "2010-04-01", NULL, %twilio_number%]
@adatta02
adatta02 / tick_tack.html
Created November 27, 2011 20:26
binding DOM events to objects
<div id="board"></div>
<style>
#board {
width: 150px;
font-size: 28px;
font-family: Arial;
margin: auto;
padding-top: 25px;
}
@adatta02
adatta02 / process_gather.php
Created December 23, 2011 05:35
Checks an IMAP mailbox for exception emails and then makes a call via Twilio if a limit is hit
<?php
if( $_REQUEST["Digits"] == "1234" ){
if( file_exists(dirname(__FILE__) . "/hasExceptionNotification.lock") ){
unlink( dirname(__FILE__) . "/hasExceptionNotification.lock" );
}
touch( dirname(__FILE__) . "/pauseNotification.lock" );
$str = <<<EOF
@adatta02
adatta02 / gist:1848304
Created February 16, 2012 22:20
tru.ly webservices example
<?php
$userData = array(
"api[key]" => "YOUR_KEY",
"user[email]" => "[email protected]",
"user[first_name]" => "Dave",
"user[last_name]" => "Smith",
"user[zip_code]" => "02139",
"user[street_address]" => "222 3rd st.",
"user[birthday_month]" => "1",
"user[birthday_day]" => "1",
@adatta02
adatta02 / truly_webservice.c
Created June 8, 2012 14:46
tru.ly C# example
/*
Copyright (C) 2012 Robert Cayouette <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of