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 / node5md.js
Last active August 2, 2018 19:53
Twilio Node API Demo
// The Twilio Node library checks the environment variables
// 'TWILIO_ACCOUNT_SID' and 'TWILIO_AUTH_TOKEN' by default when instantiating a client object.
const client = require('twilio')();
const numbers = new Set()
client.messages.each({
to: '+12019497446',
}, (message) => {
if (!numbers.has(message.from)) {
numbers.add(message.from);
@sagnew
sagnew / pokemon.lua
Last active April 24, 2018 23:01
pokemon
function read_file(name)
local input = io.open(name, 'r')
if input ~= nil then
io.input(input)
content = io.read()
io.close(input)
return content
end
@sagnew
sagnew / flags.swift
Last active May 23, 2017 22:56
Debugging code challenges for ShipIt! at $BASH
enum VNodeFlag: UInt32 {
case Delete = 0x00000001
case Write = 0x00000002
case Extended = 0x00000004
case Attrib = 0x00000008
case Link = 0x00000010
case Rename = 0x00000020
case None = 0x00000080
}
@sagnew
sagnew / app.py
Created May 23, 2017 20:58
Python debugging code challenge
import re
from flask import Flask, request
from twilio import twiml
app = Flask(__name__)
@app.route('/sms', methods=['POST']): # This decorator has no function. There should be a function def on the next line.
@sagnew
sagnew / bash.bas
Last active August 30, 2017 08:16
$BASH 2017 Apple IIe BASIC game
10 REM Clear the screen
20 TEXT : HOME
25 REM DISPLAY WELCOME SCREEN
30 VTAB 4: HTAB 15: PRINT "$BASH RACER"
40 VTAB 13: HTAB 3: PRINT "USE LEFT AND RIGHT ARROW KEYS TO MOVE"
50 VTAB 14: HTAB 7: PRINT "ANY OTHER KEY GOES STRAIGHT"
60 VTAB 21: PRINT "PRESS ANY KEY TO PLAY"
65 VTAB 23: PRINT "SCORE 5000 POINTS TO WIN"
70 REM WAIT FOR KEYPRESS
80 GET KEY$
@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']
<!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 / 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
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 / 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