Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

  • Google
  • San Francisco, CA, USA
View GitHub Profile
@IronistM
IronistM / exportSheetAsJSON.gs.js
Created April 8, 2015 21:05
Google Sheet as JSON
// Credit Christian Boutin
function exportSheetAsJSON() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var output = "";
output += "{\""+sheet.getName()+"\" : {\n";
@andreaderrico2
andreaderrico2 / README.md
Last active September 23, 2017 17:01
CodeMirror demo
@dommmel
dommmel / Coce.gs
Created August 2, 2015 13:28
Google Apps Script to upload and import a CSV File into a Google Spreadsheet
// http://stackoverflow.com/questions/11273268/script-import-local-csv-in-google-spreadsheet
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Upload CSV file", functionName: "doGet"}];
ss.addMenu("CSV", csvMenuEntries);
}
function doGet(e) {
var app = UiApp.createApplication().setTitle("Upload CSV to Sheet");
@operator-DD3
operator-DD3 / editor.html
Created August 11, 2015 03:21
A simple DATA:URI editor
<html> <head> <style> h1 { background-color: black; color: white; } </style> <script> function myfunc() { document.getElementById("myP").innerHTML = "<A HREF=data:text/html;charset=utf-8," + encodeURI(document.getElementById("text1").value) + ">output</a>" } </script> </head> <h1><center>Data:URI Editor</center></h1> <textarea id="text1" cols="80" rows="12"></textarea> <br> <button type="button" onclick="myfunc()">Create URI</button> <p id="myP"></p> </html>
@pnavarrc
pnavarrc / README.md
Last active July 1, 2021 09:28
Jade Preview
#!/bin/bash
if [ -z "$1" ]; then
MB=1024
else
MB="$1"
fi
if [ -z "$2" ]; then
browser="google-chrome-beta"
@coderofsalvation
coderofsalvation / cronjoblock
Last active July 23, 2024 16:22
cronjob wrapper with locking support
# portable cronjob wrapper to ensure :
#
# * only one process at the time (prevents process-overlap, handy for unique cron workers)
# * reverse cron's email behaviour (only emails on error)
# * ultraportable: only relies on flock, not on debians 'start-stop-daemon' or centos 'daemon'
# * nicelevel to tame cpu usage
#
# usage: cronjoblock <application> [args]
# example: cronjoblock /home/foo/myscript &
# cronjoblock /home/foo/myscript & <--- 'myscript' will only run when the previous run is finished
@P8H
P8H / install_watchdog.sh
Last active July 24, 2021 16:53
Watchdog install script for Raspberry Pi
# Watchdog install script for raspberry pi
# based on http://binerry.de/post/28263824530/raspberry-pi-watchdog-timer
# first think about to update the firmaware: rpi-update
sudo bash
apt-get install watchdog chkconfig
modprobe bcm2708_wdog
echo "WantedBy=multi-user.target" >> /lib/systemd/system/watchdog.service
# http://raspberrypi.stackexchange.com/a/33901
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active July 8, 2025 10:31
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
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@yock
yock / uri.sh
Last active December 28, 2018 23:42
URL Parsing function for Bash
#
# URI parsing function
#
# The function creates global variables with the parsed results.
# It returns 0 if parsing was successful or non-zero otherwise.
#
# [schema://][user[:password]@]host[:port][/path][?[arg1=val1]...][#fragment]
#
function uri_parser() {
# uri capture