Skip to content

Instantly share code, notes, and snippets.

View thinkingserious's full-sized avatar
🦉

Elmer Thomas thinkingserious

🦉
View GitHub Profile
@thinkingserious
thinkingserious / sendgrid_python_asm_groups_example.py
Last active September 23, 2015 16:55
SendGrid Python v3 ASM Groups Example
import sendgrid
import os
if os.path.exists('.env'):
for line in open('.env'):
var = line.strip().split('=')
if len(var) == 2:
os.environ[var[0]] = var[1]
client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
status, msg = client.asm_groups.get()
@thinkingserious
thinkingserious / sendgrid_python_api_keys_example.py
Last active September 22, 2015 15:57
SendGrid Python v3 API Keys Example
import sendgrid
import os
if os.path.exists('.env'):
for line in open('.env'):
var = line.strip().split('=')
if len(var) == 2:
os.environ[var[0]] = var[1]
client = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
status, msg = client.apikeys.get()

Keybase proof

I hereby claim:

  • I am thinkingserious on github.
  • I am thinkingserious (https://keybase.io/thinkingserious) on keybase.
  • I have a public key whose fingerprint is 64E5 2C12 D835 AEB8 A109 DFA2 990F 4A17 FDBF EDC1

To claim this, I am signing this object:

@thinkingserious
thinkingserious / GetStats-WindowsPhone-SendGrid.cs
Last active August 29, 2015 14:05
GetStats - a function that retrieves data from the SendGrid Web API stats endpoint from within a Windows Phone 8.1 app
public async Task<ObservableCollection<EmailStats>> GetStats(uint days = 1, uint aggregate = 0)
{
if (days < 1)
throw new ArgumentException("The days argument must be larger than 0.", "days");
if (days > 1095)
throw new ArgumentException("The days argument must be less than 1096.", "days");
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(
new Uri(String.Format("{0}stats.get.json?api_user={1}&api_key={2}&date=1&days={3}&aggregate={4}",
@thinkingserious
thinkingserious / HomeController.cs
Created July 18, 2014 00:43
SendGrid Event Webhook Client Endpoint
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
using SendGridEventWebhook.Models;
using Newtonsoft.Json;
namespace SendGridEventWebhook.Controllers
{
// Display the default home page for this example
public class HomeController : Controller
@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; }
@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 {
<!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 / 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",
@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: