Skip to content

Instantly share code, notes, and snippets.

View jonmarkgo's full-sized avatar
🎓
preparing the MLH Fellowship

Jonathan Gottfried jonmarkgo

🎓
preparing the MLH Fellowship
View GitHub Profile
@jonmarkgo
jonmarkgo / gist:2949616
Created June 18, 2012 17:40
Set up LED
const int ledPin = 13; //digital pin your LED is plugged into, I recommend 13 since its next to GND
WiFlyClient client;
void setup() {
//...
pinMode(ledPin, OUTPUT);
}
@jonmarkgo
jonmarkgo / gist:2949602
Created June 18, 2012 17:38
WiFly Loop
void loop()
{
//turn on the LED if the TCP socket is open
if (client.connected()) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
@jonmarkgo
jonmarkgo / gist:2949583
Created June 18, 2012 17:36
Basic WiFly Setup
#include <SPI.h>
#include <WiFly.h>
char* ssid = "my$ssid$lol"; //enter your SSID here, replace all spaces with $ (ex. "my ssid lol" = "my$ssid$lol")
char* pass = "abc123"; //enter your wifi passphrase here
char* serverAddress = "1.2.3.4"; //enter the IP of your node.js server
int serverPort = 1337; //enter the port your node.js server is running on, by default it is 1337
WiFlyClient client;
@jonmarkgo
jonmarkgo / maze.py
Created May 4, 2012 03:06
Maze Thing
correct_maze_moves = ["left","right","left"]
correct_moves_made = 0
def exit_maze():
print "YOU WIN"
def enter_maze():
global correct_moves_made
print "what way do you go in the maze?"
next = raw_input ("> ")
@jonmarkgo
jonmarkgo / .gitignore
Created April 13, 2012 18:32
Two-Factor Authentication with Node.js and Twilio - Completed Example
.DS_Store
node_modules
@jonmarkgo
jonmarkgo / app-pt1.js
Created April 13, 2012 18:22
Two-Factor Authentication with Node.js and Twilio
var client = new TwilioClient('ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'yourwebsite.com');
var phone = client.getPhoneNumber('+18881234567');
app.configure(function () {
app.set('view engine', 'jade');
app.set('view options', {layout: false});
app.use(express.cookieParser());
app.use("/bootstrap", express['static'](__dirname + '/bootstrap'));
app.use(express.session({
secret: 'secret',
key: 'express.sid',
@jonmarkgo
jonmarkgo / body.html
Created March 28, 2012 17:27
Twilio Phone Verification Blog Post
<form id="enter_number">
<p>Enter your phone number:</p>
<p><input type="text" name="phone_number" id="phone_number" /></p>
<p><input type="submit" name="submit" value="Verify" /></p>
</form>
<div id="verify_code" style="display: none;">
<p>Calling you now.</p>
<p>When prompted, enter the verification code:</p>
<h1 id="verification_code"></h1>
@jonmarkgo
jonmarkgo / call.php
Created March 28, 2012 17:11
Simple Phone Verification with Twilio, PHP, MySQL, and jQuery
<?php
require("Services/Twilio.php");
require("database.php");
// require POST request
if ($_SERVER['REQUEST_METHOD'] != "POST") die;
// generate "random" 6-digit verification code
$code = rand(100000, 999999);
@jonmarkgo
jonmarkgo / callpeople.py
Created February 21, 2012 02:50
Twilio Cat Facts by Akiva Bamberger
def call_people(self, newbie):
self.call_person(newbie)
# send 5 texts to people who haven't gotten one in over 4 hours
people = Numbers.gql("WHERE last_touched < :1", last_time()).fetch(5)
for person in people:
self.call_person(person)
@jonmarkgo
jonmarkgo / app.yaml
Created February 21, 2012 02:50
Twilio Cat Facts by Akiva Bamberger
application: cat-facts
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: index.py