Skip to content

Instantly share code, notes, and snippets.

View thinkingserious's full-sized avatar

Elmer Thomas thinkingserious

View GitHub Profile
@thinkingserious
thinkingserious / App Manifest
Created February 1, 2014 00:44
App Manifest for the SendGrid Glass GDK Example
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="2"
android:versionName="1"
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thinkingserious.sendgrid.glass.gdk.example">
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
@thinkingserious
thinkingserious / MainActivity.java
Last active August 29, 2015 13:55
MainActivity.java for SendGrid Glass GDK Example
package com.thinkingserious.sendgrid.glass.gdk.example;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutionException;
import org.json.JSONException;
import org.json.JSONObject;
@thinkingserious
thinkingserious / SendEmailWithSendGrid.java
Created February 1, 2014 02:08
SendEmailWithSendGrid.java for SendGrid Glass GDK Example
package com.thinkingserious.sendgrid.glass.gdk.example;
import java.util.Hashtable;
import android.os.AsyncTask;
import com.github.sendgrid.SendGrid;
// This is the magic that sends the email through SendGrid's web API.
public class SendEmailWithSendGrid extends AsyncTask<Hashtable<String,String>, Void, String> {
@thinkingserious
thinkingserious / AddressBook.java
Last active August 29, 2015 13:55
AddressBook.java for SendGrid Google Glass SDK
package com.thinkingserious.sendgrid.glass.gdk.example;
import java.util.HashMap;
/*
Since the voice recognition in Glass makes it hard to speak email addresses, we instead use nicknames
Once Contacts are implemented in the GDK, we can replace this class
*/
public class AddressBook {
private HashMap<String, String> emails;
@thinkingserious
thinkingserious / strings.xml
Created February 1, 2014 02:23
strings.xml for SendGrid Glass GDK Example
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SendGrid Glass GDK Example</string>
<string name="hello_world"></string>
<string name="send_email">send an email</string>
<!-- Menu item strings. -->
<string name="read_aloud">Read aloud</string>
<string name="send">Send the Email</string>
@thinkingserious
thinkingserious / api-design-with-apiaryio
Last active August 29, 2015 13:56
GTD Todo API Blueprint Example
FORMAT: 1A
HOST: http://api.gtdtodoapi.com
# GTD TODO API
This is an example API, written as a companion to a blog post at SendGrid.com
## Folder [/folder{id}]
A single Folder object, it represents a single folder.
Required attributes:
@thinkingserious
thinkingserious / app.py
Created February 14, 2014 02:39
API Design with APIairy.io, Python and Flask example code
#!flask/bin/python
from flask import Flask, jsonify, abort, make_response, request
app = Flask(__name__)
folders = [
{
"id": 1,
"name": "Health",
"description": "This represents projects that are related to health",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://app.userapp.io/css/demo/tutorial.css">
</head>
<body>
<div class="container" style="text-align: center;">
@thinkingserious
thinkingserious / gist:94cb5ccbae82d26e0acc
Created May 29, 2014 02:11
userapp-function-signup
function signup() {
UserApp.User.save({
login: document.getElementById("username").value,
first_name: document.getElementById("name").value,
email: document.getElementById("email").value,
password: document.getElementById("password").value
}, function(error, user) {
if (error) {
alert("Error: " + error.message);
} else {
@thinkingserious
thinkingserious / SendGridEvents.cs
Created July 18, 2014 00:40
SendGrid Event Webhook Model
using Newtonsoft.Json;
using System.Collections.Generic;
namespace SendGridEventWebhook.Models
{
// This class models the data we POST from our Event Webhook stream
public class SendGridEvents
{
// Docs: https://sendgrid.com/docs/API_Reference/Webhooks/event.html
public string email { get; set; }