Skip to content

Instantly share code, notes, and snippets.

@TerranTian
TerranTian / URLSearchParamsHelper.js
Last active September 7, 2022 02:15
parse search string to object
export function parseQuery(query) {
query = query.substring(query.indexOf("?") + 1);
var re = /([^&=]+)=?([^&]*)/g;
var decodeRE = /\+/g;
var decode = function (str) {
return decodeURIComponent(str.replace(decodeRE, " "));
};
@TerranTian
TerranTian / index.js
Created August 8, 2020 03:32 — forked from mikkipastel/index.js
facebook chatbot from cloud function in firebase
//Reference from https://medium.com/@Astider/how-to-สร้าง-messenger-chatbot-แบบ-serverless-ด้วย-google-firebase-908c3eaba67e
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
// Create and Deploy Your First Cloud Functions
// https://firebase.google.com/docs/functions/write-firebase-functions
@TerranTian
TerranTian / README.md
Created August 3, 2020 07:03 — forked from CodingDoug/README.md
How to schedule a Cloud Function to run in the future (in order to build a Firestore document TTL)