Skip to content

Instantly share code, notes, and snippets.

@matthewrknoll
matthewrknoll / Code.gs
Created January 24, 2017 17:21
Automatically include your latest Tweet in your Gmail signature.
// Grabs my latest tweet using the handy TwtrService wrapper by +MartinHawksey - https://goo.gl/2it7yb
function getLatestTweet() {
var data = TwtrService.get("statuses/user_timeline", {screen_name: /*"YourTwitterHandle(without the @)"*/, count: 1});
var id = data[0].id_str;
// Grabs embed code for my latest tweet. Would look much prettier if Gmail could render it properly.
var response = UrlFetchApp.fetch('https://publish.twitter.com/oembed?url=https://twitter.com/Interior/status/'+id);
var json = JSON.parse(response);
var text = json.html;
@matthewrknoll
matthewrknoll / Code.gs
Created January 19, 2017 02:43
Beliefs Inventory - Self Grading Google Form
function onFormSubmit(e) {
//Gets the incoming form response
var formResponse = e.response;
//Puts the response from each question into an array
var itemResponses = formResponse.getItemResponses();
//Gets the respondent's email address
var email = formResponse.getRespondentEmail();
//Extracts the first and last name from the response
var name = itemResponses.splice(0, 2);
//An array containing how many dots are on the paper form in sequential order