Skip to content

Instantly share code, notes, and snippets.

tanyagupta tanyagupta

  • Washington DC
Block or report user

Report or block tanyagupta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tanyagupta / Gruntfile.js
Last active May 26, 2018
Sample Gruntfile.js for GWG-MWS (Grow with Google Mobile Web Specialist)
View Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
pkg: grunt.file.readJSON('package.json'),
options:{}, /* left blank to keep it simple */
tanyagupta /
Last active Jan 25, 2018
Use the YouTube ID of Udacity close captioned videos to extract the transcript
function doGet() { // this starts the Google Apps server
var template = HtmlService.createTemplateFromFile('extract_text_from_youtube');
var title_string='Get transcript from Udacity Video';
return template.evaluate()
function getTranscript(id){
var resp = UrlFetchApp.fetch(""+id) //UrlFetchapp to avoid ajax issues related to CORS
tanyagupta / find_item_in_array.js
Created Jan 8, 2017
How to find an item in an array
View find_item_in_array.js
function item_in_array(){
var fruits = ["Bob", "Rob", "Amanda", "Cheryl","Susan"];
Logger.log(fruits.indexOf("Susan")) //returns 4 which is the index of Susan
Logger.log(fruits.indexOf("Frank")) //returns -1 since the item is not found
tanyagupta / drive_fetch.js
Last active Jan 2, 2017
UrlFetchApp with Drive (multiple pages)
View drive_fetch.js
var all_results ={};
var response = UrlFetchApp.fetch(""+mime_type,params);
var result=JSON.parse(response.getContentText()) ;
for (var i in result['files']) {
all_results[result['files'][i]['id']] = result['files'][i]['name'];
while (result['nextPageToken']) {
var pageToken = encodeURIComponent(result['nextPageToken']);
tanyagupta / fetch.js
Last active Jan 2, 2017
UrlFetchApp script with Zendesk (multiple pages)
View fetch.js
function zd_get (cmd) {
var url = ZD_BASE+cmd;
var results =[];
var service = getService();
if (service.hasAccess()) {
do {
try {
var response = UrlFetchApp.fetch(url, {headers: {'Authorization': 'Bearer ' + service.getAccessToken(),}});
tanyagupta / UI.html
Created Dec 30, 2016
Using D3 in GAS
View UI.html
<script src="" charset="utf-8"></script>
tanyagupta / hello_world_c9_express_with_comments.js
Last active Dec 4, 2016
Node.js web app using Express in Cloud9 - heavily commented
View hello_world_c9_express_with_comments.js
// Standard set up for the express code to work with your code
var express = require('express');
var app = express();
Routes a get request, and in this simple case - to the server's root. It sends a
call back to handle the request. Not much will happen here, the call back is hardcoded
to send a hello world string. But in theory you can do something with the req variable
in the "/" directory, create a dynamic html and send that back
tanyagupta / hello_world_c9_node.js
Created Dec 3, 2016
Simple Hello Word using http in node
View hello_world_c9_node.js
var http = require("http");
var server = http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write("<h1>Hello World</h1>");
console.log("Server is listening");
tanyagupta / hello_world_c9_express.js
Last active Dec 4, 2016
Node.js web app using Express in Cloud9
View hello_world_c9_express.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send("<h1>hello world</h1>");
app.listen(8080, function () {
console.log('Example app listening on port 8080!');
//call this app from https://<workspace name>-<user name>
You can’t perform that action at this time.