Skip to content

Instantly share code, notes, and snippets.

View sivartravis's full-sized avatar

Travis Taylor sivartravis

  • Cambridge, MA
View GitHub Profile
@omz
omz / New from Gist.py
Created November 15, 2012 04:52
New from Gist
### Based on: https://gist.github.com/b0644f5ed1d94bd32805
### This version strips unicode characters from the downloaded script
### to work around the currently limited unicode support of the editor
### module.
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@ttscoff
ttscoff / textexpander_gen.rb
Last active March 22, 2017 15:36
Mass generate TextExpander snippets from a CSV file
#!/usr/bin/ruby
require 'csv'
require 'erb'
require 'cgi'
if ARGV.length == 2
input_csv = ARGV[0]
output_te = ARGV[1]
unless output_te =~ /\.textexpander$/
puts "Second argument must have a '.textexpander' extension."
@westonruter
westonruter / README.md
Last active November 10, 2023 22:24
Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember the Milk

Google Apps Script for Gmail to automatically forward Google Now notes to self onto Remember The Milk, transforming the transcribed speech into Smart Add syntax, and then archiving the thread in Gmail. Create a new script in Google Drive for Gmail, paste this JS into it, customize the rtm_email variable to your own, and customize the transformations to rtm_task for Smart Add to fit your style, and then set up a trigger to invoke the function every minute. Within approximately a minute after sending yourself a note via Google Now, the reminder will be added to your RTM account!

Example dictation: Note to self to look up article about widgets for work priority 1
Smart Add transformation: Look up article about widgets #work !1

Resources

/*
___________________________________________________________________________________
***THE FOLLOWING METHOD(s) ARE USING SIMILAR ROUTINES AND ARE CALLED DYNAMICALLY.
THEY REDIRECT TO INTERNAL METHOD(s), THUS, DOCUMENTATION IS STATED HERE***
____________________________________________________________________________________
METHOD(s): addElement/insertElement
DEFINITION: Appends or inserts an element node
PARAMETER(s):
@katowulf
katowulf / 1_using_queries.js
Last active April 24, 2023 07:14
Methods to search for user accounts by email address in Firebase
/***************************************************
* Simple and elegant, no code complexity
* Disadvantages: Requires warming all data into server memory (could take a long time for MBs of data or millions of records)
* (This disadvantage should go away as we add optimizations to the core product)
***************************************************/
var fb = firebase.database.ref();
/**
* @param {string} emailAddress
@ianlewis
ianlewis / csv_import_magic.js
Last active February 3, 2023 13:16
A Google Apps Script for importing CSV data into a Google Spreadsheet.
// vim: ft=javascript:
/*jslint sloppy: true, vars: true, white: true, nomen: true, browser: true */
/*global SpreadsheetApp, UiApp, UrlFetchApp, Utilities */
/*
* A script to automate requesting data from an external url that outputs CSV data.
*
* Adapted from the Google Analytics Report Automation (magic) script.
* @author nickski15@gmail.com (Nick Mihailovski)
* @author ianmlewis@gmail.com (Ian Lewis)
*/
@patt0
patt0 / cbl.js
Last active March 7, 2024 20:12
ContinuousBatchLibrary is a Google Apps Script library that manages large batches and works around the 5 minute limitation of GAS execution. It does this by setting time based triggers in the future as well as memorising the last processed key in the batch in order to restart from the correct position. At the end of the batch a cleanup function …
/**
* --- Continous Execution Library ---
*
* Copyright (c) 2013 Patrick Martinent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@hisnipes
hisnipes / GoogleSpreadsheet_SavePDF_EmailAuto.js
Created February 5, 2014 21:10
Google Apps Script: Using custom menu, save Google Spreadsheet as PDF with custom options (landscape/portrait, gridlines) in Google Drive and automatically email PDF as attachment to multiple recipients. Credit: produced in conjunction with Victor W. Yee.
// Create custom menu within Spreadsheet
function onOpen() {
var submenu = [{name:"Save and Email PDF", functionName:"spreadsheetToPDF"}];
SpreadsheetApp.getActiveSpreadsheet().addMenu('Admin Functions', submenu);
}
// Start spreadsheetToPDF function
function spreadsheetToPDF(key) {
// Authentication stuff
@varun-raj
varun-raj / pullJSON.js
Last active October 31, 2022 16:19
Google App Script To Fetch Data From JSON Webservice and Write them to google spreadsheet.
function pullJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var url="http://example.com/feeds?type=json"; // Paste your JSON URL here
var response = UrlFetchApp.fetch(url); // get feed
var dataAll = JSON.parse(response.getContentText()); //