Skip to content

Instantly share code, notes, and snippets.

Avatar

Gareth gahrae

  • Boulder, CO, USA
View GitHub Profile
@mogsdad
mogsdad / Apps Script pdfToText utility.md
Last active Apr 10, 2021
For http://stackoverflow.com/questions/26613809, 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 utility.md

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);
    
@shawndumas
shawndumas / .gitconfig
Created Aug 5, 2013
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
View .gitconfig
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@lttlrck
lttlrck / Int64.js
Created Nov 22, 2012
64-bit Integer type for Javascript based on Int64.js but NodeJS dependency on buffer removed, plus some other small mods.
View Int64.js
// Int64.js
//
// Copyright (c) 2012 Robert Kieffer
// MIT License - http://opensource.org/licenses/mit-license.php
/**
* Support for handling 64-bit int numbers in Javascript (node.js)
*
* JS Numbers are IEEE-754 binary double-precision floats, which limits the
* range of values that can be represented with integer precision to:
@kg
kg / decodeFloat.js
Created Mar 25, 2012
Decode 32/64-bit float from bytes in JavaScript
View decodeFloat.js
// Derived from http://stackoverflow.com/a/8545403/106786
function decodeFloat(bytes, signBits, exponentBits, fractionBits, eMin, eMax, littleEndian) {
var totalBits = (signBits + exponentBits + fractionBits);
var binary = "";
for (var i = 0, l = bytes.length; i < l; i++) {
var bits = bytes[i].toString(2);
while (bits.length < 8)
bits = "0" + bits;