Skip to content

Instantly share code, notes, and snippets.

@sdesalas
sdesalas / Async.gs
Last active August 23, 2024 11:43
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
@dai-shi
dai-shi / benchmark-simpleregex.js
Last active December 14, 2015 23:59
benchmark regex.test, string.match, and string.search
var Benchmark = require('benchmark');
Benchmark.prototype.setup = function() {
s = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtestyyyyyyyyyyyyyyyyyyyyy';
re = new RegExp('te[xs]t');
};
var suite = new Benchmark.Suite();
// add tests
suite.add('regex test', function() {
var r1 = re.test(s);