Skip to content

Instantly share code, notes, and snippets.

View Max-Makhrov's full-sized avatar
🇺🇦

Max Makhrov Max-Makhrov

🇺🇦
View GitHub Profile
@Max-Makhrov
Max-Makhrov / Cross-join-Google-Sheets2.1.sheets
Last active May 5, 2021 08:48
Formulas for Cartessian cross-join in Google Sheets
=ArrayFormula(
VLOOKUP(
CEILING(ROW(OFFSET(INDIRECT("A1"),,,COUNTA(A2:A)*COUNTA(B2:B)))/COUNTA(B2:B)) ,
{ROW(A2:A)-row(A1),A2:A} , 2, )
)
// TODO
// 1. test
// 2. error handler
// 3. instructions on trigger installation
// AKfycbz7GZDZb3Yt1usqUkIu_lNOp4tW0xUKuFR9K_fIksIGuep2TeJ5RU0J
// the script assumes this structure of historic table:
// ______________________________________
@Max-Makhrov
Max-Makhrov / createValidation.js
Last active October 11, 2020 08:39
2D Dependent Dropdown List. Max Makhrov
function make2DDataValidation() {
// ............................... Settings ......................................
// Sheet names
var tsheet = 'Sheet1'; // The name of the work sheet with data validation
var dsheet = 'data'; // The name of the data sheet
// The data validation range:
var rownum = 1000; // The number of the last row of validation
@Max-Makhrov
Max-Makhrov / copy-checklist.js
Last active June 24, 2020 06:18 — forked from niallsmart/copy-checklist.js
Copy Trello checklist to console
$(".checklist-item").map(function(i, item) {
let text = $(item).find(".checklist-item-details-text").text();
if( $(item).hasClass("checklist-item-state-complete") ) {
text += " (DONE)";
}
return text;
}).get().join('\n')
@Max-Makhrov
Max-Makhrov / dump.vim
Last active May 27, 2020 08:20 — forked from mattn/dump.vim
google-calendar-holiday
scriptencoding utf-8
let s:calendar_list = [
\ ['Australian Holidays', 'en.australian#holiday@group.v.calendar.google.com'],
\ ['Austrian Holidays', 'en.austrian#holiday@group.v.calendar.google.com'],
\ ['Brazilian Holidays', 'en.brazilian#holiday@group.v.calendar.google.com'],
\ ['Canadian Holidays', 'en.canadian#holiday@group.v.calendar.google.com'],
\ ['China Holidays', 'en.china#holiday@group.v.calendar.google.com'],
\ ['Christian Holidays', 'en.christian#holiday@group.v.calendar.google.com'],
\ ['Danish Holidays', 'en.danish#holiday@group.v.calendar.google.com'],
@Max-Makhrov
Max-Makhrov / Code.gs
Created May 19, 2020 07:08
Embed Google Form into Google Apps-Script HTML-Form
function launchTheForm_() {
// create a form-template object
let html = HtmlService.createTemplateFromFile('form').evaluate().setWidth(650).setHeight(1331);
// show the form to user
SpreadsheetApp.getUi().showModalDialog(html, ' ');
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
/*
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/
/*
_____ _ _ _ __
| __ \ | | | | | | \ \
| |__) |_ _ ___| |_ ___ | |__| | ___ _ __ ___ \ \
| ___/ _` / __| __/ _ \ | __ |/ _ \ '__/ _ \ \ \
@Max-Makhrov
Max-Makhrov / SimpleTimerResult.js
Created March 26, 2020 12:26
The time to run function for JS, Google Apps Script
// usage
function cars_importRef() {
var t = new Date();
// YOUR CODE
Browser.msgBox('Done! The time to run function is ' + getTimeEllapse_(t));
}
function getTimeEllapse_(t)
{
var dif = new Date() - t;
@Max-Makhrov
Max-Makhrov / Copy-multiple-Sheets-Google-Speadsheets.gs
Created March 30, 2018 11:35
The code helds to copy sheets between files in 1 click
/* Done!
1. Copy multiple sheets between files with 1 click
2. Delete "copy of..." from sheet name. Leave original name if possible*.
3. Delete and recreate named ranges. Leave original name if possible.
4. Repair formulas → to prevent #N/A, #Ref errors
* no naming conflicts
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*