Skip to content

Instantly share code, notes, and snippets.

View schlos's full-sized avatar

Miroslav schlos

View GitHub Profile
@schlos
schlos / gist:b837c70b689a5317c346b1caebb5b1b7
Created July 6, 2024 10:27 — forked from peterherrmann/gist:2700284
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
/**
* Invokes a function, performing up to 5 retries with exponential backoff.
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of
* about 32 seconds before it gives up and rethrows the last error.
* See: https://developers.google.com/google-apps/documents-list/#implementing_exponential_backoff
<h3>Examples:</h3>
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email
var example1 = GASRetry.call(function(){return "Hello, " + Session.getActiveUser().getEmail();});
</pre><pre>//Calls an existing function
var example2 = GASRetry.call(myFunction);
@schlos
schlos / how-to-gource.sh
Created October 22, 2022 01:27 — forked from miguelsaddress/how-to-gource.sh
Install Gource in Ubuntu (gource.io)
#Install Gource in Ubuntu
========================
#Go to the folder.... and
#see http://tylerfrankenstein.com/code/install-gource-ubuntu-1010-visualize-git-repo
sudo apt-get update
sudo apt-get install libsdl2-dev libsdl2-image-dev libpcre3-dev libfreetype6-dev libglew-dev libglm-dev libboost-filesystem-dev libpng12-dev libsdl1.2-dev libsdl-image1.2-dev libtinyxml-dev
./configure
make
sudo make install
@schlos
schlos / label-github-emails-in-gmail.gs
Created October 20, 2020 06:31 — forked from Rican7/label-github-emails-in-gmail.gs
Filters Gmail message threads to apply helpful GitHub labels, for organization.
/**
* Labels Gmail email threads
*/
function labelGithubEmails() {
/**
* Gmail label names for GitHub messages
*/
const githubLabelName = 'GitHub'
const githubPullRequestLabelName = 'GitHub/Pull Request'
const githubIssueLabelName = 'GitHub/Issue'
@schlos
schlos / Google App Script - Replace Slide Content Using Google Sheet Data.js Google Apps Script function to replace text in Google Slides with Google Sheet values
/**
* Function to replace text in Google Slides with Google Sheet values
* @reference https://hudsonatwell.co/2020/10/03/how-to-use-google-slides-to-autogenerate-featured-images/
*/
function generate_featured_image() {
/* get spreadsheet from public view link */
var dataSpreadsheetUrl = "https://docs.google.com/spreadsheets/d/1necmbNPUsGJ3fwNiFpgNLbtH6c2RmJDwIQCPuhAfA7s/edit"; //make sure this includes the '/edit at the end
var ss = SpreadsheetApp.openByUrl(dataSpreadsheetUrl);
@schlos
schlos / outerLoop.js
Created April 30, 2020 19:53 — forked from peterherrmann/outerLoop.js
outerLoop for Google Apps Script triggered functions is some boilerplate that encapsulates best practice ways to deal with running workloads that may take longer to process that the time available in an Apps Script triggered run.
//load configuration details and start logging - creates and sets up sheets the first time they are run
var CONFIG_SPREADSHEET_KEY = '<ssid_goes_here>';
var Config = SettingsManager.load(CONFIG_SPREADSHEET_KEY); //Add Mafviu9bMfg9xVu21LGfpWnHAGDwXQ1CH in Resources > Libraries
Logger = BetterLog.useSpreadsheet(Config['logSpreadsheetId'].value);//Add MYB7yzedMbnJaMKECt6Sm7FLDhaBgl_dE in Resources > Libraries
// trigger this function
function outerLoop() {
try {
// to calc elapsed time
var isOverMaxRuntime = false,
@schlos
schlos / detect-patterns.user.js
Created October 3, 2019 09:17 — forked from sonota88/detect-patterns.user.js
Greasemonkey script which detect patterns in html source.
// ==UserScript==
// @name detect-patterns
// @namespace anbt
// @include *
// ==/UserScript==
(function(){
if (window != unsafeWindow.top) { return; }
@schlos
schlos / contact-form.html
Created April 6, 2019 09:25 — forked from sharu725/contact-form.html
Jekyll Contact Form using Formspree
<!--
After implementing this contact form make sure
1. you have defined "email: [email protected]" in _config.yml file.
2. you verify your form on formspree.io.
-->
<form class="wj-contact" action="https://formspree.io/{{site.email}}" method="POST">
<input type="text" name="email" placeholder="Email Address">
<textarea type="text" name="content" rows="10" placeholder="Message"></textarea>
<input type="hidden" name="_next" value="<REDIRECTION LINK> ">
@schlos
schlos / Log.gs
Last active November 3, 2020 21:52 — forked from andrewroberts/Log.gs
A simple wrapper for the BetterLog Google Apps Script Library - GAS Library MqTFuiXcPtS5rVUZ_jC9Z4tnfWGfgtIUb
// 34567890123456789012345678901234567890123456789012345678901234567890123456789
// JSHint: 22 March 2015 08:56 GMT
// Unit Tests: 22 March 2015 08:50 GMT
/*
* Copyright (C) 2015-2017 Andrew Roberts ([email protected])
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
@schlos
schlos / google-apps-script-github-burndown.js
Created January 16, 2019 12:26 — forked from gregorynicholas/google-apps-script-github-burndown.js
google apps script to create a github issues burndown chart
/**
* Heads to github fetches milestone info, and adds rows to spreadsheet
*/
function updateBugCounts() {
var resp = UrlFetchApp.fetch("https://api.github.com/repos/DramaFever/www/milestones?access_token=XXX");
var jsonStr = resp.getContentText();
var milestones = Utilities.jsonParse(jsonStr);
var dataSs = SpreadsheetApp.openById("YYY");
var sheet = dataSs.getSheetByName('Raw Data');
@schlos
schlos / question.md
Last active January 1, 2019 14:05 — forked from rubenrivera/question.md
Question - Answer from Web Applications [Show URL used to edit responses from a Google Form in a Google Spreadsheet by using a script](http://webapps.stackexchange.com/q/89551/88163)

Revision 3 http://webapps.stackexchange.com/revisions/89551/3

Show URL used to edit responses from a Google Form in a Google Spreadsheet by using a script

I'm trying to make the edit URL for a Google Form automatically populate in the response Google Sheet that it's attached to. I've seen this already and want to use it, but I'm having issues trying to figure out where exactly to put the script.

I've tried putting it in the script editor in the Google Spreadsheet that I would like the URL to appear in, but I'm not sure where to go from there. In the script editor I've tried to test it as an add-on but that didn't end up working.

I have little experience with scripts and the script editor in Google Sheets. As a final note I am using one other add-on called AutoCrat in the same Google Spreadsheet.