Skip to content

Instantly share code, notes, and snippets.


Tim Lytle tjlytle

View GitHub Profile
View benford.php
$limit = 1000000;
$counts = [
'1' => 0,
'2' => 0,
'3' => 0,
'4' => 0,
'5' => 0,
'6' => 0,
'7' => 0,
View index.html
<a target="_blank" href='chrome-extension://maldgfaihandkckmgabpbkgnjbafnbog/settings.html'>Configure Extension</a>
View library-responder.php
require_once __DIR__ . '/vendor/autoload.php';
$client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Basic(NEXMO_KEY, NEXMO_SECRET));
try {
$inbound = \Nexmo\Message\InboundMessage::createFromGlobals();
} catch (Exception $e) {
error_log('could not parse inbound message');
View simple-responder.php
if (!isset($_POST['msisdn'], $_POST['to'], $_POST['text'])) {
return; // not a nexmo request
if ("yes" === strtolower(substr($_POST['text'], 0, 3))) {
// here's where you need to do something to store the inbound phone number
error_log('got message from: ' . $_POST['msisdn']);
// reply with the message (this is a bit hacky, but should work anywhere)

Hands On API Design (this gist)

Tutorial Requirements

Don't stress over this. Even if you come without a laptop, you should be able to learn from the tutorial.

  • A laptop with an internet connection, pen, and paper will be all that’s needed to activly participate in most of the tutorial.
  • If you want to follow along during the coding, any modern(5.3+) PHP development environment will work.
tjlytle / example.conf
Created March 13, 2017 16:30
Routing /api in nginx
View example.conf
location /api/ {
alias /;
fastcgi_pass api:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/public/index.php;
fastcgi_param REQUEST_URI $request_filename;
View edit.js
console.log('must pass a spec to edit');
require("swagger-editor/package.json"); // swagger-editor is a peer dependency.
var editor = require("swagger-editor-server");
editor.edit(process.argv[2], process.argv[3]);
tjlytle /
Last active September 30, 2016 01:24

LaraconUS 'Advice' Demo

If you want to troll your friends with this, here you go. Caution, if [used in a live demo][1], [may][2] [have][3] [unexpected][4] [results][5].

Super Importaint Note: The get() method used here is basically a prototype, so it certianly may change. /warning

App Setup

Add this to composer.json, to bring in both the Nexmo client and Laravel package as their currently in beta:

View ClientFactory.php
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class ClientFactory implements AbstractFactoryInterface
protected $services = [
View gist:2f1bc52bc09556e764fe
<vxml version = "2.1" >
<field name="department">
<prompt>Please say sale or support. </prompt>
<grammar mode="voice" root="top">
<rule id="top">