Skip to content

Instantly share code, notes, and snippets.

View oshliaer's full-sized avatar
😼
Cat face with wry smile

Alex Ivanov oshliaer

😼
Cat face with wry smile
View GitHub Profile
@tanaikech
tanaikech / submit.md
Created March 4, 2019 04:50
Adding Title of vAxis to Embedded Chart on Spreadsheet using Google Apps Script

Adding Title of vAxis to Embedded Chart on Spreadsheet using Google Apps Script

When a chart is created by using EmbeddedChartBuilder of Spreadsheet service, the title of vAxis which is put by setOption("vAxis", {title: "y axis"}) doesn't work. It is considered that this is a bug. Because I have confirmed that this had worked fine. Ref But this specification had been changed. So I would like to introduce the method for adding the title of vAxis when a chart is created using Google Apps Script.

Sample data

Sample script 1

This is a sample script using EmbeddedChartBuilder of Spreadsheet service.

@sagirk
sagirk / learn-react.md
Created November 18, 2018 18:23
How to become a React expert
  1. Carefully do the official [tutorial][].
  2. Read the official guide to [main concepts][].
  3. Read the official [advanced guides][].
  4. Watch [building React from scratch][] to get an idea of how React actually works (this covers the "stack" reconciler which was used in React 15 and earlier).
  5. Go through the [React "fiber" architecture][] which is the default reconciler since React 16.
  6. Go crazy, build your own projects, and stop doing React tutorials!
@tanaikech
tanaikech / submit.md
Last active September 30, 2020 06:10
Asynchronous Processing using Event Triggers

Asynchronous Processing using Event Triggers

September 21, 2018 Published.

Kanshi Tanaike

@tanaikech
tanaikech / submit.md
Last active March 14, 2024 18:55
Enhanced makeCopy() using Google Apps Script

Enhanced makeCopy() using Google Apps Script

Overview

This is sample scripts for copying files to a specific folder in Google Drive using Google Apps Script (GAS).

Description

When the files in Google Drive are copied to a specific folder using GAS, most users will use makeCopy(destination). When the files are copied using makeCopy(), you might have already noticed that only the standalone projects cannot be copied to the specific folder. They are copied to the root folder (My Drive). Also this situation can be also seen even when "copy" of Drive API v2 and v3 is used. I think that this might be a bug. So I would like to introduce 2 sample scripts as the workaround. In the workaround, it uses Drive API.

Sample script 1

This sample is very simple.

@tanaikech
tanaikech / submit.md
Last active April 26, 2025 03:48
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

News

At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.

Description

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
@tanaikech
tanaikech / submit.md
Created August 11, 2018 07:29
Benchmark: Decreasing Loop for Array Processing using Google Apps Script

Benchmark: Decreasing Loop for Array Processing using Google Apps Script

August 11, 2018 Published.

Kanshi Tanaike

@postman31
postman31 / extensions_checker.gs
Last active January 14, 2022 06:17
The script checks for adgroups and campaigns with no particular extensions
//Options setcion
var OPTIONS = {
'REPORT_URL': '', // url of existing report sheet. leave empty string to create new report when script runs
'LOOKBACK': '', // optional lookback for items selectors that picks non removed items in loookback period. Defolts to 'LAST_7_DAYS'
'EXTENSIONS': ['sitelinks', 'callouts', 'snippets'], // list of extnesions to check. Defaults to ['sitelinks', 'callouts', 'snippets', 'phoneNumbers']
'FORCE_CHECK': true // If true will report if adgroup doesn't contain particular extension but it's available at campaign level. Defaults to false
}
function getOptions () {
var options = {}
@romanitalian
romanitalian / questions_for_interview.md
Last active June 6, 2024 18:59
Questions for interview - Вопросы для собеседования
Вопросы по шаблонам проектирования:
  • Почему глобальные объекты и статика — это зло? Можете показать на примере кода?
  • Расскажите об инверсии управления и как она улучшает организацию кода.
  • Закон Деметры (Принцип минимальной информированности) гласит, что каждый программный модуль должен обладать ограниченным знанием о других модулях и должен взаимодействовать только с непосредственными «друзьями» (иногда его формулируют как «Не разговаривай с незнакомцами»). Можете написать код, который нарушает этот принцип? Почему у него плохая организация и как её исправить?
  • Active-Record — шаблон проектирования, который поощряет внедрение в сам объект функций, таких как Insert, Update и Delete, и свойств, которые соответствуют столбцам некоей базовой таблицы в базе данных. По вашему мнению и опыту, какие ограничения и подводные камни у этого шаблона?
  • Data-Mapper — шаблон проектирования, который поощряет использование слоя преобразователей (mappers), перемещающих данные между объектами и базой данных, в то же
@tanaikech
tanaikech / submit.md
Last active April 27, 2025 06:06
Adding Query Parameters to URL using Google Apps Script

Adding Query Parameters to URL using Google Apps Script

Updated on February 5, 2024

This is for adding the query parameters to the URL. These scripts can be also used for Javascript. When I created an endpoint with some query parameters, I had used the scripts of various patterns every time. Today, I prepared this sample script to unify them. If this is also useful for you, I'm glad.

Sample script (With V8 runtime):

String.prototype.addQuery = function (obj) {
@tanaikech
tanaikech / submit.md
Created July 9, 2018 23:52
Limitation of Images for Inserting to Spreadsheet using Google Apps Script

Limitation of Images for Inserting to Spreadsheet using Google Apps Script

Introduction

Here I would like to introduce about the limitation of images for inserting to Spreadsheet using Google Apps Script (GAS). When you want to insert the images to Spreadsheet using GAS, insertImage() of class Sheet is usually used for this situation. At this time, an error sometimes occurs. This indicates that there is the limitation for inserting images to Spreadsheet. So I investigated the limitation.

As a result, it was found that the limitation depends on the image area (pixels^2) rather than the file size of it. The maximum area of image which can be inserted was 1,048,576 pixels^2.

Experiment

In order to investigate the limitation, I have converged the condition by changing the file size and the image size. By this, it was found that the limitation depends on the image area (pixels^2) rather than the file size of it. For this confirmation, I can show you the following experimental data.