This file contains 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
// 一般寫法 | |
let temp = true | |
if (temp) { | |
todoSomething() | |
} | |
// 短路求值 | |
temp && todoSomething() |
This file contains 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
<button onclick="setData()">set</button> | |
<script> | |
const db = firebase.firestore(); | |
function setData() { | |
db.collection("to-do-list").doc("to-do").set({ | |
item: "處理 ...", | |
date: "20XX-XX-XX", | |
desctiption: "...", |
This file contains 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
<button onclick="getData()">get</button> | |
<script> | |
function getData() { | |
const docs = db.collection("to-do-list").doc("to-do"); | |
docs | |
.get() | |
.then(doc => { | |
if (doc.exists) { |
This file contains 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
<button onclick="setData()">set</button> | |
<script> | |
function setData() { | |
firebase.database().ref('user-datas').set({ | |
username: 'dylan', | |
email: '[email protected]' | |
}); | |
} | |
</script> |
This file contains 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
firebase.database().ref('user-datas').on('value', snapshot => { | |
console.log(snapshot.val()); | |
}); |
This file contains 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 { Machine, interpret } from 'xstate'; | |
// This machine is completely decoupled from React | |
export const toggleMachine = Machine({ | |
id: 'toggle', | |
initial: 'inactive', | |
states: { | |
inactive: { | |
on: { TOGGLE: 'active' } | |
}, |
This file contains 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
{"version":1,"resource":"file:///Volumes/projects/mono/web/apps/mainuc-dashboard-ui/pages/dashboard/balanceDetail/index.tsx","entries":[{"id":"RVnc.tsx","timestamp":1655269437378},{"id":"DSgb.tsx","source":"undoRedo.source","timestamp":1655269473387}]} |
This file contains 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 axios = require("axios"); | |
const headers = { | |
"Access-Control-Allow-Headers": "Content-Type", | |
"Access-Control-Allow-Origin": "*", | |
"Access-Control-Allow-Methods": "OPTIONS,POST,GET", | |
} | |
exports.handler = async (event) => { | |
const queryString = event.queryStringParameters || {}; |
This file contains 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 aws = require("aws-sdk"); | |
const s3 = new aws.S3(); | |
const bucketName = "test-firebase-dynamic-links"; | |
const s3FileName = "links_map.json"; | |
function getDataFromS3() { | |
const params = { | |
Bucket: bucketName, | |
Key: s3FileName, |
This file contains 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 axios = require("axios"); | |
+ const aws = require("aws-sdk"); | |
+ const s3 = new aws.S3(); | |
+ const bucketName = "test-firebase-dynamic-links"; | |
+ const s3FileName = "links_map.json"; | |
+ function getDataFromS3() { | |
+ const params = { | |
+ Bucket: bucketName, |
OlderNewer