Skip to content

Instantly share code, notes, and snippets.

View caseysoftware's full-sized avatar

Danger Casey caseysoftware

View GitHub Profile
@caseysoftware
caseysoftware / gist:1332870
Created November 2, 2011 04:39
twimlet tweak
Change this:
$response->addDial($_GET['PhoneNumber'],
array("action"=>$actionUrl,
"timeout"=>$_REQUEST['Timeout'] ? $_REQUEST['Timeout'] : 30));
to this:
$response->addDial($_GET['PhoneNumber'],
array("action"=>$actionUrl,
@caseysoftware
caseysoftware / delete-recordings.php
Created February 21, 2012 06:58
This is a simple script using the Twilio PHP Helper library to retrieve Recordings within a certain date range and then delete them.
<?php
// This assumes you have the Twilio PHP Helper library
require 'Services/Twilio.php';
// This is a file with my Account Sid and AuthToken
include 'credentials.php';
$client = new Services_Twilio($accountsid, $authtoken);
/*
@caseysoftware
caseysoftware / delete-recordings.py
Created February 21, 2012 20:50
This is a simple script using the Twilio Python module to retrieve Recordings within a certain date range and then delete them.
from datetime import date
from twilio.rest import TwilioRestClient
account = "ACxxxx"
token = "xxxxxx"
client = TwilioRestClient(account, token)
recordings = client.recordings.list(after=date(2012, 1, 1))
@caseysoftware
caseysoftware / gist:1878920
Created February 21, 2012 21:02
This is a simple script using cURL to delete a single recording.
curl -X DELETE 'https://api.twilio.com/2010-04-01/Accounts/ACxxxx/Recordings/RExxxx.json' -u ACxxxx:{AuthToken}
@caseysoftware
caseysoftware / targetted-delete.php
Created February 22, 2012 06:13
This is a simple script using the Twilio PHP Helper library to retrieve Calls within a certain date range and the delete their associated recordings if they're particularly short.
<?php
require 'Services/Twilio.php';
include 'credentials.php';
$toNumber = "{fill this in with your number}";
$client = new Services_Twilio($accountsid, $authtoken);
$calls = $client->account->calls->getIterator(0, 50, array("To" => $toNumber, "StartTime<" => "2011-11-10"));
@caseysoftware
caseysoftware / gist:1923300
Last active October 1, 2015 04:48
Code to generate the one-time use password
function user_generate_token($username, $phoneNum, $method){
global $accountsid, $authtoken, $fromNumber;
/**
* Create a store a temporary/one-time password. While session-based is ok for
* this proof of concept, to make this more secure we'd want to use a database,
* potentially a salt for the password, and some sort of timeout to expire the
* password of N minutes/hours.
*/
@caseysoftware
caseysoftware / gist:1923307
Last active October 1, 2015 04:48
Code to generate the password
function user_login($username, $submitted) {
/**
* Retrieve the temporary/one-time password. While session-based is ok for
* this proof of concept, to make this more secure we'd want to use a database
* some sort of timeout to expire the password of N minutes/hours.
*/
$stored = $_SESSION['password'];
// Compare the retrieved vs the stored password
if ($stored == $submitted) {
<?php
if($_POST['submitButton']=="Submit Order"){
echo "<h1>Order Confirmation Page!</h1><br />";
echo "Name: {$_POST['Name']}<br />";
echo "Address: {$_POST['Address']}<br />";
echo "Cheese Choices: ";
foreach($_POST['cheese'] as $value){
echo "$value ";
}
echo "<br />";
@caseysoftware
caseysoftware / gist:3975284
Created October 29, 2012 18:02
OPTIONS samples
curl -X OPTIONS 'http://localhost/web2project-slim/' -v | python -m json.tool
{
"resource_uri": "/",
"root_uri": "/web2project-slim",
"self": "/web2project-slim/",
"sub_resources": {
"admin": {
"name": "User Admin",
"uri": "/web2project-slim/admin"
@caseysoftware
caseysoftware / gist:3975297
Created October 29, 2012 18:03
OPTIONS sample for Projects
curl -X OPTIONS 'http://localhost/web2project-slim/projects' -v | python -m json.tool
{
"actions": {
"create": {
"href": "/web2project-slim/projects",
"method": "POST",
"optional": [
"project_company",
"project_name",