Skip to content

Instantly share code, notes, and snippets.

View sirateek's full-sized avatar
👋

Siratee K. sirateek

👋
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sirateek on github.
  • I am sirateek (https://keybase.io/sirateek) on keybase.
  • I have a public key ASDH9BiXodKM7TIzYi_gUjFxg94eDxry9Lx2wqJxPq_r8go

To claim this, I am signing this object:

// Simple Trigger (normal onEdit() Function) have the restriction which can't be used to call any functions
// that required the authorization. So use Installable Trigger instead.
// Warning:! Set Trigger for one time only otherwise you will have duplicate triggers!.
// Note: createSpreadsheetOpenTrigger will not return anything if success.
function createSpreadsheetOpenTrigger() {
var ss = SpreadsheetApp.getActive();
// Set Installable Trigger.
ScriptApp.newTrigger('specialOnEdit').forSpreadsheet(ss).onEdit().create();
}
const request = require("request-promise");
const crypto = require("crypto");
const UUID = require("uuid-v4");
var baseUrl = "https://api-pay.line.me";
var extension = `/v3/payments/request`;
var channelSecret = "";
var nonce = UUID();
console.log(nonce);
const queryString = decodeURIComponent(window.location.search)
.replace("?liff.state=", "")
.substr(1);
console.log(queryString);
liff.ready.then(() => {
if (!liff.isLoggedIn()) {
liff.login({
redirectUri:
"https://tutorial.sirateek.me/LIFF/page2.html?" + queryString,
});
function fallback(agent) {
var word = "Decoded message from users"; // Message from user
return db.collection("Unknown-Word").doc(word).set({
"word": word,
});
}).catch((e) => {
console.log(e);
return null;
});
}
liff.ready
.then(() => {
if (liff.isLoggedIn()) {
return liff.getProfile();
} else {
liff.login({
redirectUri: "https://tutorial.sirateek.me/medium/GoogleForm_LIFF/",
});
}
})
<!DOCTYPE html>
<head>
<title>กำลังเข้าสู่ Form</title>
<style>
.centerScreen {
margin-top: 20;
margin-right: auto;
margin-bottom: 20;
margin-left: auto;
Map<String, dynamic> tryParseJwt(String token) {
if (token == null) return null;
final parts = token.split('.');
if (parts.length != 3) {
return null;
}
final payload = parts[1];
var normalized = base64Url.normalize(payload);
var resp = utf8.decode(base64Url.decode(normalized));
final payloadMap = json.decode(resp);
Future<FirebaseUser> signInWithApple() async {
if (await AppleSignIn.isAvailable()) {
final AuthorizationResult result = await AppleSignIn.performRequests([
AppleIdRequest(requestedScopes: [Scope.email, Scope.fullName])
]);
AuthCredential credential;
switch (result.status) {
case AuthorizationStatus.authorized:
credential = OAuthProvider(providerId: "apple.com").getCredential(
idToken: String.fromCharCodes(result.credential.identityToken),