Skip to content

Instantly share code, notes, and snippets.

View sagnew's full-sized avatar

Sam Agnew sagnew

  • Twilio
  • New York City
View GitHub Profile
@sagnew
sagnew / gist:f0772ac77fe64c5484cf
Last active August 29, 2015 14:04
Foodbot todo/ideas
User Friendliness:
Display more restaurants if only 2 or 3 have different cuisine
Display order number when order is placed, and total price.
Display prices of meals when displaying meals
Display top 5 matches
Bugs:
Bot gets killed for unknown reasons
$(document).ready(function(){
var total = $("div[id^='0']").length;
var count = 0;
var click_array = [];
var run = function(){
$('td>div').each(function() {
$(this).one( "click", function() {
$( this ).css( "background-color", "blue" );
click_array.push(this);
@sagnew
sagnew / food.py
Created June 24, 2015 18:40
Quick python help
candy = 'snickers'
right = True
while right:
answer = (raw_input('whats your favorite candy? '))
if answer == candy:
print 'yes'
right = False
elif answer == 'chocolate' or answer == 'food':
print 'close. try again'
@sagnew
sagnew / resend.php
Created June 24, 2015 20:50
PHP Resend example
<?php
$client = new Services_Twilio($AccountSid, $AuthToken);
$messageSIDs = array("Insert", "Array of", "Message SIDs", "here");
foreach ($messageSIDs as $sid) {
$msg = $client->account->messages->get($sid);
if ($msg->status == "undelivered") {
@sagnew
sagnew / pennapps.py
Created September 4, 2015 22:03
PennApps demo make phones ring
from twilio.rest import TwilioRestClient
client = TwilioRestClient()
for msg in client.messages.iter(to='74310', date_sent='2015-09-04'):
client.calls.create(to=msg.from_, from_='+16103475323',
url='http://gnarly.io/pennappsvoice.xml')
@sagnew
sagnew / app.py
Last active October 28, 2015 22:30
The Martian
import requests
from flask import Flask
from flask import request, send_from_directory
from twilio import twiml
from martianify import martianify
UPLOAD_FOLDER = '/Users/sagnew/Test/Martian/'
# App declaration and configuration
npm WARN package.json gameboy@0.1.0 No repository field.
npm WARN package.json gameboy@0.1.0 No license field.
|
> canvas@1.3.1 install /Users/sagnew/Test/IPM/gameboy/node_modules/canvas
> node-gyp rebuild
SOLINK_MODULE(target) Release/canvas-postbuild.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/canvas-postbuild.node] Error 1
@sagnew
sagnew / chat.js
Last active November 25, 2015 04:12
// We will be using jQuery to manipulate DOM elements for the chat.
var $ = require('jquery');
// Manages the state of our access token we got from the server
var accessManager;
// Our interface to the IP Messaging service
var messagingClient;
// The object we are going to export as this module
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Yay Video</title>
</head>
<body>
<div id="eddie"></div>
<div id="sam"></div>
<script src="https://media.twiliocdn.com/sdk/js/common/v0.1/twilio-common.min.js"></script>
@sagnew
sagnew / app.py
Created August 17, 2016 19:29
Receive an SMS in Python video
from flask import Flask, request
from twilio import twiml
app = Flask(__name__)
@app.route('/sms', methods=['POST'])
def sms():
number = request.form['From']