Skip to content

Instantly share code, notes, and snippets.

Spencer-Easton /
Last active Oct 16, 2021
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
alexfu / CursorExtenstions.kt
Created Jun 30, 2015
Android database cursor extensions that simplify retrieval of typed values
View CursorExtenstions.kt
import android.database.Cursor
* CursorExtentions
* Android database cursor extensions that simplify retrieval of typed values
* @author alexfu
fun Cursor.getInt(colName: String): Int {
return this.getInt(this.getColumnIndex(colName))
alexfu /
Last active Sep 26, 2015
View utility functions that I find myself using often.
* The MIT License (MIT)
* Copyright (c) 2015 Alex Fu
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
mogsdad / Apps Script pdfToText
Last active Aug 24, 2021
For, a question about getting pdf attachments in gmail as text. I got a little carried away - this does much more than asked.
View Apps Script pdfToText

Google Apps Script pdfToText Utility#

This is a helper function that will convert a given PDF file blob into text, as well as offering options to save the original PDF, intermediate Google Doc, and/or final plain text files. Additionally, the language used for Optical Character Recognition (OCR) may be specified, defaulting to 'en' (English).

Note: Updated 12 May 2015 due to deprecation of DocsList. Thanks to Bruce McPherson for the getDriveFolderFromPath() utility.

    // Start with a Blob object
    var blob = gmailAttchment.getAs(MimeType.PDF);
alexfu /
Last active Apr 6, 2021
Observer pattern for notifying Fragments of a ViewPager to update their views. This will update the current Fragment, as well as the off screen Fragments that are retained.
public class FragmentObserver extends Observable {
public void notifyObservers() {
setChanged(); // Set the changed flag to true, otherwise observers won't be notified.
mhawksey / gist:1442370
Last active Sep 22, 2021
Google Apps Script to read JSON and write to sheet
View gist:1442370
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
View OCR Scan
if [ $# -gt 1 ]
SOURCE="--source ADF -l 3"