Skip to content

Instantly share code, notes, and snippets.

View andrewwatson's full-sized avatar
🤡
Cranking Out The Code

Andrew Watson andrewwatson

🤡
Cranking Out The Code
View GitHub Profile
@andrewwatson
andrewwatson / wtf.php
Created March 2, 2012 21:04
#lolwtfphp #facepalm
<?php
header('Content-type: image/gif');
echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAUUAAAALAAAAAABAAEAAAICRAEAOw==");
?>
@andrewwatson
andrewwatson / fetchContact.xml
Created February 19, 2012 20:22
InfusionSoft Load Contact XMLRPC Response
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>LastUpdatedBy</name>
<value>
<i4>-1</i4>
// models/User.php
/**
* Check if the user used the domain prefix
* to login. If they did pass param through
* unchanged. If they didn't, prepend it and
* return it.
* @param string $username
* @return string
*/
@andrewwatson
andrewwatson / nuance.php
Created November 11, 2011 03:27
Example Nuance Integration
<?php
$headers = array(
"X-Language: en-US",
"X-Service: FullAuto",
"X-Reference: voicecloud-reference-123",
"Content-Type: audio/wav",
"Content-Transfer-Encoding: base64",
"Content-Length: " . filesize("test2.64.wav")
);
@andrewwatson
andrewwatson / chatter2.py
Created November 9, 2011 02:22
Chatter Pie
#!/usr/bin/python
import sys
from chatterbotapi import ChatterBotFactory, ChatterBotType
factory = ChatterBotFactory()
bot1 = factory.create(ChatterBotType.CLEVERBOT)
bot1session = bot1.create_session()
@andrewwatson
andrewwatson / test.php
Created July 19, 2011 21:37
multiple cookies
<?php
if (isset($_COOKIE['one'])) {
$new_one = $_COOKIE['one'] += 1;
$new_two = $_COOKIE['two'] += 1;
setcookie('one', $new_one);
setcookie('two', $new_two);
$response = "One says " . $new_one . " but Two says ". $new_two;
} else {
setcookie('one', 1);
@andrewwatson
andrewwatson / sms.php
Created June 30, 2011 03:53
Call me and Read Me A Text
<?php
// Where I define my credentials in AccountSid and AuthToken
include("../config.inc");
// Twilio Helper Library
include("twilio.php");
$what = $_POST['Body'];
@andrewwatson
andrewwatson / secret.php
Created June 16, 2011 18:09
SMS To Demo
<?php
header("Content-type: text/xml");
if ($_POST['Digits'] == "12345") {
$response = '
<Say>That is Correct</Say>
<Gather action="send.php" numDigits="10">
<Say>Type the number of the person to message</Say>
</Gather>
';
@andrewwatson
andrewwatson / saystuff.xml
Created June 15, 2011 20:21
Say Stuff Demo
<Response>
<Say>I am a man. This is how I talk. 1 2 3 4. Skippy Dippy Waffle Sauce.</Say>
<Pause length="1" />
<Say voice="woman">I am a woman. I have a much nicer voice than that man.</Say>
<Pause length="1" />
<Say language="es">Por favor, manténgase alejado de las puertas</Say>
</Response>
<?php
$sn = $argv[1];
$asid = $argv[2];
$vurl = $argv[3];
$sid = "ACxxxxxxxxxxxxxxxxxxxx";
$token = "xxxxxxxxxxxxxxx";