This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"facility_name": { | |
"en": "Free Wi-Fi", | |
"th": "ฟรี Wi-Fi", | |
"cn": "免费无线网络" | |
}, | |
"facility_id": "WIFI" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { NextApiRequest, NextApiResponse } from 'next'; | |
const axios = require('axios'); | |
const openaiKey = 'OPEN_AI_KEY'; | |
const getOpenAI = async (prompt: string) => { | |
const response = await axios.post( | |
'https://api.openai.com/v1/completions', | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moment from 'moment' | |
export const convertDateToTimestamp = (date: string, format: string): number => { | |
if (format === 'DD/MM/YYYY') { | |
const dateToParts = date.split("/"); | |
const dateToFormat = Number(new Date(+Number(dateToParts[2]), Number(dateToParts[1]) - 1, +Number(dateToParts[0]))); | |
return dateToFormat | |
} else { | |
return 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const calcAPoolSize = (aPrice, constantProduct) => { | |
return Math.sqrt(constantProduct / aPrice); | |
}; | |
const calcBPoolSize = (aPrice, constantProduct) => { | |
return Math.sqrt(constantProduct * aPrice); | |
}; | |
const calculateImpermanentLoss = ( | |
priceInitialA, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.zip(['a', 'b'], [1, 2], [true, false]); | |
// => [['a', 1, true], ['b', 2, false]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// xor | |
_.xor([2, 1], [2, 3]); | |
// => [1, 3] | |
// xorBy | |
_.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); | |
// => [1.2, 3.4] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.without([2, 1, 2, 3], 1, 2); | |
// => [3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// uniq | |
_.uniq([2, 1, 2]); | |
// => [2, 1] | |
// uniqBy | |
_.uniqBy([2.1, 1.2, 2.3], Math.floor); | |
// => [2.1, 1.2] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// union | |
_.union([2], [1, 2]); | |
// => [2, 1] | |
// unionBy | |
_.unionBy([2.1], [1.2, 2.3], Math.floor); | |
// => [2.1, 1.2] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// take | |
_.take([1, 2, 3]); | |
// => [1] | |
_.take([1, 2, 3], 2); | |
// => [1, 2] | |
_.take([1, 2, 3], 5); | |
// => [1, 2, 3] |
NewerOlder