Skip to content

Instantly share code, notes, and snippets.

View oshliaer's full-sized avatar
😼
Cat face with wry smile

Alex Ivanov oshliaer

😼
Cat face with wry smile
View GitHub Profile
@tanaikech
tanaikech / submit.md
Last active May 3, 2020 21:30
Benchmark: Search for Array Processing using Google Apps Script

Benchmark: Search for Array Processing using Google Apps Script

July 2, 2018

Kanshi Tanaike

Introduction

@ChrisBaker97
ChrisBaker97 / ChunkyCache.gs
Last active February 4, 2022 05:35 — forked from pilbot/ChunkyCache.gs
Using the Google Apps Script Cache Service for objects above 100Kb
function ChunkyCache(cache, chunkSize){
chunkSize = chunkSize || 100*1024;
return {
put: function (key, value, timeout) {
var json = JSON.stringify(value);
var cSize = Math.floor(chunkSize / 2);
var chunks = [];
var index = 0;
while (index < json.length){
cKey = key + "_" + index;
@tanaikech
tanaikech / submit.md
Last active May 28, 2018 11:13
Retrieving Reformatted Scripts without Comments in a Project using Google Apps Script

Retrieving Reformatted Scripts without Comments in a Project using Google Apps Script

Overview

This is a sample script for easily retrieving the reformatted scripts without comments in a project using Google Apps Script (GAS).

Description

When I create GAS script, if the format of script is not correct, the script editor lets me know about it. By this, I can find that the script editor and/or Google Drive checks the format of scripts. I had wished if I could use this function. Recently, I noticed an interesting function. A GAS project is created and when function myFunction() {Logger.log(this)} is run in the script, I noticed that all scripts in the project are included in this. Furthermore, when I saw the retrieved script, also I noticed that their scripts are reformatted and all comments are removed. In the case of Apps Script API, when the scripts are retrieved by the API, the retrieved script is the same to the original one. So I think that this will help users retrieve simply the reformat

@coinsandsteeldev
coinsandsteeldev / dialog.html
Last active September 8, 2024 11:18 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
function drawForm() {
if (!data) return
var outputEl = document.getElementById(formId);
@rmckeel
rmckeel / gulp-spawn.js
Last active August 9, 2021 23:37
Gulp no-dependency spawn / execute a file with live stdout feedback
const gulp = require( 'gulp' );
const spawn = require( 'child_process' ).spawn;
/**
* This solution to execute and watch a shell function from Gulp is
* adapted from https://stackoverflow.com/a/10232330/3232832
*
* e.g. callSpawn( 'ping', [ '-c 5', 'google.com' ], cb );
*/
function callSpawn( command, arguments, cb ) {
@ghoneycutt
ghoneycutt / hosts.md
Created May 2, 2018 21:13
default /etc/hosts

macos

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
@brainysmurf
brainysmurf / jsonp.gs
Created April 24, 2018 13:10
jsonp in google apps scripting
/*
Suppose there is some endpoint that returns a jsonp to you, as in Google Visualization API
It gives you a text response that looks like this:
"some.namespace.nameOfFunction({obj:'blah'})"
We want the object inside that function call.
In a google app scripting context, we have no choice but to evaluate it the old-fashioned way, using "evil" eval().
This solution builds a variable that resolves the namespace some.namespace.blah.blah and which ultimately becomes
a function that returns the passed parameter.
We build the variable with raw text, then eval it, giving the local context the ability to resolve the namespace and
@tanaikech
tanaikech / submit.md
Last active August 4, 2024 22:05
Benchmark: Loop for Array Processing using Google Apps Script without V8

Benchmark: Loop for Array Processing using Google Apps Script without V8

April 16, 2018 Published.

July 26, 2018 Updated. Result of reduce was added.

@tanaikech
tanaikech / submit.md
Last active June 28, 2023 06:59
Benchmark: Event Objects for Google Apps Script

Benchmark: Event Objects for Google Apps Script

Introduction

There are event objects at Google Apps Script. Typically, users which use Spreadsheet often use onEdit(event). Here, I would like to introduce the process costs for the event objects using this onEdit(event).

When onEdit(event) is used for the spreadsheet, event of onEdit(event) has the following structure.

{
 "authMode": {},
@MSerj
MSerj / formatnumber.js
Created April 13, 2018 07:41
format number with spaces
function numberWithSpaces(nr) {
return nr.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}