This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bring in the Tessel basics | |
var tessel = require('tessel'); | |
// Needle for HTTP requests | |
var needle = require('needle'); | |
// There's a button on the Tessel, when it is pressed, send an email! | |
tessel.button.on('release', function(time){ | |
// Bundle up the elements we need for our email and verification | |
var data = "api_user=sendgrid-api-user&api_key=sendgrid-api-keyn&[email protected]&[email protected]&subject=Hi from your Tessel!&text=This was sent from a Tessel"; | |
// Send it all to SendGrid and handle the responses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install -g tessel | |
$ tessel update | |
$ tessel wifi -n MyWifi -p myw1f1pass -s wpa2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ heroku create | |
// wait for creation to happen | |
$ heroku addons:add scheduler | |
$ heroku addons:open scheduler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env node | |
// Requirements, SendGrid and Request (http.request will also work and you can drop Request) | |
var sendgrid = require('sendgrid')(process.env.sendgrid_username, process.env.sendgrid_api_key); | |
var request = require('request'); | |
var applications = []; | |
var html = ""; | |
// Some settings, not always necessary | |
var settings = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img alt="My Image" src="data:image/jpeg;base64,/9j/4S/+RXhpZgAATU0AKgAAAAgACAESAAMAENkDZ5u8/61a+X...more encoding" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<img src="cid:myimagecid"/> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var params = { | |
smtpapi: new sengrid.SmtpapiHeaders(), | |
... //some vars removed here! | |
files: [ | |
{ | |
filename: 'image.jpg', | |
contentType: 'image/jpeg', | |
cid: 'myimagecid', | |
content: ('yourbase64encodedimageasastringcangohere' | Buffer) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
// Initialize Parse with your Parse application & javascript keys | |
Parse.initialize("your_parse_app_key", "your_parse_javascript_key"); | |
// Setup the form to watch for the submit event | |
$('#myForm').submit(function(e){ | |
e.preventDefault(); | |
// Grab the elements from the form to make up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Contact Form</title> | |
<!-- We need the hosted versions of jQuery and the Parse library --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://www.parsecdn.com/js/parse-1.2.16.min.js"></script> | |
<script src="/js/emailer.js"></script> | |
<style type="text/css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parse.Cloud.define("sendEmail", function(request, response) { | |
var sendgrid = require("sendgrid"); | |
sendgrid.initialize("your_sendgrid_username", "your_sendgrid_password"); | |
var name = request.params.name; | |
var email = request.params.email; | |
var message = request.params.message; | |
sendgrid.sendEmail({ | |
to: "[email protected]", |