Skip to content

Instantly share code, notes, and snippets.

Avatar
😋

Max Makhrov Max-Makhrov

😋
View GitHub Profile
@Max-Makhrov
Max-Makhrov / copy-checklist.js
Last active Jun 24, 2020 — forked from niallsmart/copy-checklist.js
Copy Trello checklist to console
View copy-checklist.js
$(".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 — forked from mattn/dump.vim
google-calendar-holiday
View dump.vim
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
Embed Google Form into Google Apps-Script HTML-Form
View Code.gs
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 / gist:5a36610a2dd1eaff3d3252d74e34d557
Last active Aug 10, 2021 — forked from peterherrmann/gist:2700284
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
View gist:5a36610a2dd1eaff3d3252d74e34d557
/**
* 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
* <br>Author: peter.herrmann@gmail.com (Peter Herrmann)
<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
@Max-Makhrov
Max-Makhrov / SimpleTimerResult.js
Created Mar 26, 2020
The time to run function for JS, Google Apps Script
View SimpleTimerResult.js
// 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 / xml_to_json.gs
Created Mar 13, 2020
Google Apps Script to convert XML to JSON
View xml_to_json.gs
function test_xmlToJson(xmlString) {
var xmltext = '<ALEXA VER="0.9" URL="davidwalsh.name/" HOME="0" AID="="><SD TITLE="A" FLAGS="" HOST="davidwalsh.name"><TITLE TEXT="David Walsh Blog :: PHP, MySQL, CSS, Javascript, MooTools, and Everything Else"/><LINKSIN NUM="1102"/><SPEED TEXT="1421" PCT="51"/></SD><SD><POPULARITY URL="davidwalsh.name/" TEXT="7131"/><REACH RANK="5952"/><RANK DELTA="-1648"/></SD></ALEXA>';
var xml = XmlService.parse(xmltext);
Logger.log(JSON.stringify(xmlToJson_(xml)));
// returns this:
//{
// "ALEXA":{
// "@attributes":{
// "VER":"0.9",
// "URL":"davidwalsh.name/",
@Max-Makhrov
Max-Makhrov / submit.md
Last active Aug 26, 2021
Upload image from your Computer to Google Drive using HTML-form. Show image via URL (IMAGE function) in your Spreadsheet
View submit.md

Upload image from your Computer to Google Drive using HTML-form. Show image via URL (IMAGE function) in your Spreadsheet

About the script

The sctipt was originally designed by Kanshi TANAIKE.

Please see the original script and instructions first.

Script : Google Apps Script

@Max-Makhrov
Max-Makhrov / submit.md
Last active Aug 9, 2020 — forked from tanaikech/submit.md
Uploading Local Files to Google Drive without Authorization using HTML Form
View submit.md

Uploading Local Files to Google Drive without Authorization using HTML Form

This is a sample script for uploading local file to Google Drive without the authorization using HTML form. A selected file in your local PC using HTML form is uploaded to Google Drive and saved to Google Drive.

When you use this, at first, please deploy Web Apps. The script is doPost() of following scripts.

Script : Google Apps Script

function doPost(e) {
  var data = Utilities.base64Decode(e.parameters.data);
View echarts.js
/*
* 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
*
@Max-Makhrov
Max-Makhrov / exportSpreadsheet.gs
Last active Sep 25, 2019 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
View exportSpreadsheet.gs
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped