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 / 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 / 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 / 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
// 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 / 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, )
)
function test_parse() {
var file = SpreadsheetApp.getActive();
var sheet = file.getSheetByName('Sheet1'); // change
var sets = {
rangeParse: sheet.getRange('L2:L16429'), // change
rangeResult: sheet.getRange("M2"), // change
func_parse: parseOkkoFilmToGetHorizontalPoster_ // change / create your function
};
parseUrls_(sets);
}
@Max-Makhrov
Max-Makhrov / Code.gs
Created May 19, 2021 11:28
Google Script. HTML-form to select image from computer and save it to Google Drive and to Sheet cell as image.
// sample file:
// https://docs.google.com/spreadsheets/d/1_rk4xFsMrxiuXqo5-HQWfvOjBU6nGDw1rlJFU0sci9U/copy
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
ui.createMenu('🙂 Click me')
.addItem('Image 🖼️ to Drive', 'showFormImages')
.addToUi();
}
@Max-Makhrov
Max-Makhrov / Dependent DropDowns 2D Wide. v0.gs
Last active May 27, 2021 06:21
2D Dependent Dropdowns for Google Sheets. ~70 lines of code. Classy sample
// Copy sample file here:
// https://docs.google.com/spreadsheets/d/1hUOuDZcfXxaLvJbEA-SxzF4oGGU3lW3iJyS4wAV8YWA/copy
function onEdit(e) {
dvl0_(e);
}
function dvl0_sets_() {
return [
{
@Max-Makhrov
Max-Makhrov / combine.gs
Last active June 9, 2021 07:26
Combine data from multiple sheets to 1
// combine data from all sheets in current file
function combineData() {
// CHANGE SHEET NAME ↓ /////////////////////////////
var sheetTo = 'combined';
////////////////////////////////////////////////////
var file = SpreadsheetApp.getActiveSpreadsheet();
var sheets = file.getSheets(); // get all the sheets
// set where we want to write the results
var outSheet = file.getSheetByName(sheetTo);
var outdata = [], sheet, sName, data = [];
@Max-Makhrov
Max-Makhrov / Timer.gs
Created April 23, 2021 14:28
Timer is a code for monitoring onMinute triggers
function readTimer() {
// [ 1 ]. Get report
var tags = ['onMinute_admin', 'onMinute_worker', 'onMinute_importer', 'onMinute_sizif1', 'onMinute_sizif2'];
var report = getTimerReps_(tags);
console.log(report);
// => gives 2D Array with a report about executions.
// So U can write it on Spreadsheet.
// [ 2 ]. Gat all data from logs