Skip to content

Instantly share code, notes, and snippets.

View ChaiyachetU's full-sized avatar

Chaiyachet Ukham ChaiyachetU

View GitHub Profile
@azadisaryev
azadisaryev / convertExcel2Sheets
Last active March 9, 2024 18:23
Google Apps Script for converting Excel (.xls or .xlsx) file to Google Spreadsheet. Drive API must be enabled in your script's Advanced Google Services and in Developers Console for the script to work (see https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services for details).
/**
* Convert Excel file to Sheets
* @param {Blob} excelFile The Excel file blob data; Required
* @param {String} filename File name on uploading drive; Required
* @param {Array} arrParents Array of folder ids to put converted file in; Optional, will default to Drive root folder
* @return {Spreadsheet} Converted Google Spreadsheet instance
**/
function convertExcel2Sheets(excelFile, filename, arrParents) {
var parents = arrParents || []; // check if optional arrParents argument was provided, default to empty array if not
@Gix075
Gix075 / formValidator.js
Last active April 28, 2020 18:19
Form Validation
/*
Form Validator 2.1.1 by Gix075
===================================================================
This is an useful class that you can use to validate any forms.
*/
function formValidator(globOpts) {
var defaults = {
bootstrap: true,
@nantcom
nantcom / getbathtext.js
Last active April 29, 2020 04:37
Get Thai Baht Text using JavaScript
var getBathText = function (inputNumber) {
var getText = function (input) {
var toNumber = input.toString();
var numbers = toNumber.split('').reverse();
var numberText = "/หนึ่ง/สอง/สาม/สี่/ห้า/หก/เจ็ด/แปด/เก้า/สิบ".split('/');
var unitText = "/สิบ/ร้อย/พ้น/หมื่น/แสน/ล้าน".split('/');
var output = "";
@CodingDoug
CodingDoug / README.md
Last active December 17, 2022 10:23
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
@CodingDoug
CodingDoug / README.md
Last active August 3, 2023 16:41
Copying Data from a Google Sheet into Firebase Realtime Database in real time via Apps Script
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active June 23, 2024 21:19
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@nwatab
nwatab / LINE-BOT-GAS-SAMPLE.js
Last active May 27, 2021 10:35
Supporterz 2 and 24, October, 2018
We couldn’t find that file to show.
@edwinlee
edwinlee / Code.gs
Last active February 21, 2024 10:43
Sync a Google Sheets spreadsheet to a Firebase Realtime database
/**
* Copyright 2019 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
function getEnvironment() {
var environment = {
spreadsheetID: "<REPLACE WITH YOUR SPREADSHEET ID>",
firebaseUrl: "<REPLACE WITH YOUR REALTIME DB URL>"
};
@akexorcist
akexorcist / buddhist-year.js
Last active April 25, 2024 10:20
MomentJS with Buddhist year
module.exports = {
toBuddhistYear: (moment, format) => {
var christianYear = moment.format('YYYY')
var buddhishYear = (parseInt(christianYear) + 543).toString()
return moment
.format(format.replace('YYYY', buddhishYear).replace('YY', buddhishYear.substring(2, 4)))
.replace(christianYear, buddhishYear)
}
}
@jirawatee
jirawatee / quickreply.json
Last active March 16, 2020 02:29
Sample in how to add LINE Quick Reply as JSON in Dialogflow
{
"line": {
"type": "flex",
"altText": "Rabbit LINE Pay",
"contents": {
"type": "carousel",
"contents": [
{
"type": "bubble",
"hero": {