Skip to content

Instantly share code, notes, and snippets.

View ChaiyachetU's full-sized avatar

Chaiyachet Ukham ChaiyachetU

View GitHub Profile
@earthchie
earthchie / ExchangeRate.js
Created March 9, 2021 10:58
get Satang and Bitkub Exchange rate
async function getExchangeRate(pair, start, end) {
return {
Satang: await getSatangExchangeRate(pair, start, end),
Bitkub: await getBitkubExchangeRate(pair, start, end)
}
}
async function getSatangExchangeRate(pair, start, end) {
start = start.getTime() - 86399999;
end = end.getTime() + 86400000;
{
"type": "bubble",
"size": "giga",
"body": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "box",
"layout": "horizontal",
{
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"contents": [
{
"type": "box",
"layout": "vertical",
"contents": [
@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": {
@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)
}
}
@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>"
};
@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.
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active June 14, 2024 12:58
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

@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
@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