Skip to content

Instantly share code, notes, and snippets.

@Dylan0916
Dylan0916 / Splashtop_exam2022.md
Last active April 16, 2022 07:34
Splashtop Inc. 前端工程師測驗作答

Splashtop Inc. 前端工程師測驗題

一、執行順序

  1. 元件載入時: B -> D -> E -> A -> C -> B -> D -> A
  2. 按下按鈕: D -> E -> A

二、時間複雜度估算

  1. 請估算 getTeamLeaderInformation 的平均時間複雜度: O(n ^ 4)
@Dylan0916
Dylan0916 / addGetAndPutDataToS3.diff
Last active September 29, 2021 16:28
添加 get 與 put S3 的 code
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,
@Dylan0916
Dylan0916 / getAndPutDataToS3.js
Created September 29, 2021 16:14
get 與 put 的 S3 操作示範
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,
@Dylan0916
Dylan0916 / genFirebaseDynamicLinks.js
Last active September 29, 2021 16:19
基本的 dynamic links 生成 code
{"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}]}
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' }
},
firebase.database().ref('user-datas').on('value', snapshot => {
console.log(snapshot.val());
});
<button onclick="setData()">set</button>
<script>
function setData() {
firebase.database().ref('user-datas').set({
username: 'dylan',
email: 'xxx@xxx.com'
});
}
</script>
<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) {
<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: "...",