Skip to content

Instantly share code, notes, and snippets.

View danthareja's full-sized avatar

Dan Thareja danthareja

View GitHub Profile
@danthareja
danthareja / cacheGoogleSheetNotesAndFormulas.js
Last active August 29, 2015 14:22
App Script to download formulas and notes from a Google Sheet
// requires ?id=<GOOGLE_SHEET_ID>
// you must have authorized access to the spreadsheet
function doGet(request) {
if (!request.parameter.id) {
return ContentService.createTextOutput(JSON.stringify(new Error('no Google Sheet id set')))
.setMimeType(ContentService.MimeType.JSON);
}
var cache = getNotesAndFormulas(request.parameter.id);
<!-- CSS -->
<style id="jsbin-css">
#pricing {
font-family: PT Sans;
}
#monthly-traffic,
#order-size{
display: block;
width: 100%;
@danthareja
danthareja / macklemore.js
Created April 8, 2015 19:46
But ____ it was 99 ___
/* Paste in the console to fill in the blanks */
console.log("but \uD83D\uDCA9 it was 99\u00A2");
@danthareja
danthareja / promises.js
Last active July 25, 2023 03:05
A conjurer's guide to promises
/*
* A quick example of how to use Bluebird and Q to conjure your own promises
*
* Everything going on here is explained further in the following video:
* http://youtu.be/OU7WuVGSuZw?list=PLT-DLWOBKbB4dZ83I_7Ca-sUTvorckG-E
*
*/
// Import node modules
var Q = require('q');
@danthareja
danthareja / magicseaweed-geektool
Created September 12, 2014 00:11
GeekTool command for displaying surf conditions from Magic Seaweed
# GeekTool command for displaying surf conditions from Magic Seaweed (there's gotta be a better way to do this)
# created by: Dan Thareja
# To use: create new 'shell' geeklet and copy the following curl command into the 'command box'
curl -s 'http://magicseaweed.com/Encuentro-Surf-Report/478/' | awk -F 'msw-js-fcc' '{print $2}' | grep '6am' | awk -F '6am' '{print $3}' | sed 's/"secondary":[^}]*//' | sed 's/"tertiary":[^}]*//' | awk -F '"' '{print ""$29" "$10"ft @ "$32"s | "$86" "$93""}' | sed 's/://g' | sed 's/,//g';
# This will print today's 6am surf conditions in Encuentro
# formatted as: [swell.compassDirection] [swell.height] @ [swell.period]s | [wind.speed] [wind.direction]