Skip to content

Instantly share code, notes, and snippets.

View pmioduszewski's full-sized avatar
🔵

Pawel Mioduszewski pmioduszewski

🔵
View GitHub Profile
@kearfy
kearfy / output.json
Created July 28, 2023 13:03
SurrealQL recursion
[
{
"id": "recursion:five",
"links": [
"recursion:four",
"recursion:two"
],
"resolved": [
{
"id": "recursion:four",
const options = {
url: "https://www.forextradingbig.com/10-facts-you-must-know-on-online-forex-trading/",
method: "GET",
proxy: proxyGenerator()
};
request(options, function(error, response, html) {
if (!error && response.statusCode == 200) {
const $ = cheerio.load(html);
let article_headings = $("h2").text();
@tanaikech
tanaikech / submit.md
Created September 14, 2020 02:02
Retrieving All URLs in Google Document using Google Apps Script

Retrieving All URLs in Google Document using Google Apps Script

This is a sample script for retrieving All URLs in Google Document using Google Apps Script. In this sample script, the method of "documents.get" in Google Docs API is used. By this, the URL can be retrieve using JSON.parse().

Sample script

Before you use this script, please enable Google Docs API at Advanced Google Services.

const documentId = "###"; // Please set the Google Document ID.
@tanaikech
tanaikech / submit.md
Last active September 2, 2023 23:01
Uploading File to Google Drive from External HTML without Authorization

Uploading File to Google Drive from External HTML without Authorization

This is a sample script for uploading a file to Google Drive from the external HTML without the authorization. In this case, the client side can be used at the outside of Google. And as the server side, the Web Apps created by Google Apps Script is used.

Usage

Please do the following flow.

1. Create new project of Google Apps Script.

@tanaikech
tanaikech / submit.md
Last active March 15, 2024 15:06
Decoding QR code on Google Slides using Google Apps Script

Decoding QR code on Google Slides using Google Apps Script

This is a sample script for decoding a QR code put in Google Slides using Google Apps Script. In this case, Javascript is used at the opened dialog. And Canvas API and jsQR are used. So unfortunately, this method cannot be used with the time-driven trigger and the Google Apps Script project of the standalone type.

Of course, this method can be also used for Google Document and Google Spreadsheet. But at Google Spreadsheet, I recommend to retrieve the image of QR code with the fetch method from URL.

Demo

@tanaikech
tanaikech / submit.md
Last active September 30, 2020 06:27
Drive API got to be able to create Google Apps Script project again

Drive API got to be able to create Google Apps Script project again

I have reported "Drive API cannot create Google Apps Script project no longer". Ref About this, I had reported the future request. Ref Today, I could confirm that the Google Apps Script project of the standalone type got to be able to be created by multipart/form-data using Drive API. This is a good news for me. By this, the following 2 patterns can be used from now.

Pattern 1:

  1. Create new standalone GAS project by Apps Script API.
  2. Put the local script to the created GAS project by updating the project with Apps Script API.
  3. Move the GAS project from the root folder to the specific folder using Drive API.

In this pattern, 3 API calls are required.

@tanaikech
tanaikech / submit.md
Last active September 30, 2020 06:18
Switching Buttons for Google Spreadsheet using Google Apps Script

Switching Buttons for Google Spreadsheet using Google Apps Script

These are the sample scripts for achieving the switching buttons for Google Spreadsheet using Google Apps Script. The management of images using Spreadsheet service is growing now. But, in the current stage, in order to achieve the switching buttons, it needs a little ingenuity. In this report, I would like to introduce 4 kinds of the switching buttons.

Pattern 1

In this pattern, the drawing is used as the button.

@tanaikech
tanaikech / submit.md
Last active April 1, 2023 11:26
Converting SVG Format to PNG Format using Google Apps Script

Converting SVG Format to PNG Format using Google Apps Script

This is a sample script for converting the SVG image data to PNG image data using Google Apps Script.

Unfortunately, in the current stage, there are no methods for directly converting the SVG to PNG in Google Drive service. But it can be achieved by Drive API. The sample script is as follows.

Before you use this, please enable Drive API at Advanced Google services.

Sample script

@tanaikech
tanaikech / submit.md
Created July 16, 2020 02:16
Retrieving Users, Sessions and PageViews of User Summary Report from Google Analytics using Google Apps Script

Retrieving Users, Sessions and PageViews of User Summary Report from Google Analytics using Google Apps Script

This is a sample script for retrieving "Users", "Sessions" and "PageViews" of User Summary Report from Google Analytics using Google Apps Script. When you use this, please enable Analytics Reporting API at Advanced Google services.

Sample script

function myFunction() {
  const viewId = "###";
  const startDate = "2020-01-01";
@tanaikech
tanaikech / submit.md
Last active May 10, 2024 06:46
Sample Scripts for Requesting to Web Apps by Various Languages