Live Note

Remain optimistic

閑著無聊看了看如何部署

公司内部有 k8s 集群,所以也需要學習如何寫 deploy 脚本.目前服務挂在 Travis CI 上,後續可能會使用自己的機器裝個 Github Runner 啥的…

步驟大致為:

  1. 在 Travis 中登錄,然後選擇需要 watch 的倉庫
  2. 編寫 deploy 文件,需要内部暴露字段的可以在 setting 中添加
  3. 在 github 中拿到 person access token,添加到 Travis

因爲 blog 還不需要 build 和 test 的步驟,所以我的 deploy file 暫時還沒有這些:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
language: node_js
node_js:
- 10 # hexo目前似乎還不支持node 14版本

branches:
only:
- master # 需要監聽的branch

before_install:
- npm install -g hexo-cli

install:
- npm install
- npm install hexo-deployer-git

before_script:
- git config user.name "${username}"
- git config user.email "${email}"
- rm -rf themes/next
- git clone https://github.com/theme-next/hexo-theme-next themes/next
- cp assets/config/_config.yml themes/next/_config.yml # 我將自己的theme config存在assets中
- cp assets/images/avatar.jpg themes/next/source/images/avatar.jpg
- sed -i "s/github_token/${GITHUB_TOKEN}/g" _config.yml

script:
- hexo clean
- hexo generate
- echo "Generation finished."
- hexo deploy

notifications:
email:
- foo@example.com
on_success: change
on_failure: always

October Plan

  • React Hook: 首要完成的目標
  • shell: 不知道能學到什麽程度
  • Linux 命令: 不知道能學到什麽程度
  • 優化之前的 code: 算是屎山了
Read more »

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
let Human = function (param) {
this.skill = (param && param.skill) || "null"
this.hobby = (param && param.skill) || "null"
}
Human.prototype = {
getSkill: function () {
return this.skill
},
getHobby: function () {
return this.hobby
},
}

let Named = function (name) {
let _this = this
;((name, _this) => {
this.wholeName = name
if (name.indexOf(" ") > -1) {
_this.FirstName = name.slice(0, name.indexOf(" "))
_this.LastName = name.slice(name.indexOf(" "))
}
})(name, _this)
}

let Work = function (work) {
let _this = this
;((work, _this) => {
switch (work) {
case "code":
this.work = "developer"
break
case "design":
this.work = "designer"
break
default:
this.work = work
}
})(work, _this)
}

Work.prototype.changeWork = function (work) {
this.work = work
}

/**
* to create a Person
* @param {*} name
* @param {*} work
*/
let Person = function (name, work) {
let _person = new Human()
_person.name = new Named(name)
_person.work = new Work(work)
return _person
}

// for test
let person = new Person("Jack Edward", "design")
console.log(person.work)
console.log(person.name)
person.work.changeWork("code")
console.log(person.work)

Boosting Flutter Performance with Frame-Based Rendering using keframe

Flutter is known for its smooth UI performance, but complex animations or frequent rebuilds can sometimes lead to jank. Frame-based rendering, also known as keyframe animation, offers a powerful technique to optimize these scenarios. This article explores how to leverage frame-based rendering in Flutter using the keframe package, focusing on FrameAnimation, FrameSeparateWidget, and SizeCacheWidget.

What is Frame-Based Rendering?

Traditional rendering in Flutter often involves rebuilding widgets every time their properties change. While efficient in many cases, this can become a bottleneck when dealing with intricate animations or rapidly changing data.

Frame-based rendering pre-calculates animation frames and stores them. During animation, the system displays these pre-rendered frames sequentially, minimizing constant rebuilds. This results in smoother animations and improved performance, especially on less powerful devices.

Read more »

In modern web development, enhancing user experience by highlighting specific text within a larger body of content is a common requirement. Whether it’s for search results, annotations, or emphasizing key information, a Highlight Text component can be incredibly useful. In this article, we’ll walk through the process of building a simple yet effective Highlight Text component using React.

Here is the Example captured:

Highlight Text Component Example

Read more »

天下无不散的宴席

实习生只剩下一个了,其他都离职了。对他们来说是件好事,呆在这里也不能提高多少。

最近发生的事情太多了:

  • 养了一只猫:某天突然就想养只猫了,下午决定晚上就去领了一只。回家后花了不少精力,现在活得还算不错。
  • 新买了个镜头:入了个 35mm f2.0 镜头,扫街+人像应该够了。
  • 不知不觉喜欢上了一个女生:深入了解后发现希望不大,还是放弃了。
  • 去了家公司参观:这家公司有 Node 中间层,是以前未接触过的。今后还需努力。
  • 刷了一点 leetcode:在公司需求不多,就刷着为以后做准备了。
  • 买了一点书:身体和心灵总有一个在路上。
  • 去桂山岛旅游:看了看人烟稀少的小镇是什么样的生活。

币圈疯狂的人们

数字货币的世界,涨跌不需要理由。
公司一群人炒币,只有一个人脱身,其余的加起来估计亏了百来万。
地铁上,公交上,餐厅奶茶店;俊男靓女,大爷大妈,所有人都在炒币,太疯狂了。

人的欲望总是无穷的,赌徒只需要输一次就能将所有的钱输完,人性的弱点。
大家都希望山底买,山顶卖。但是谁又知道你是不是买在山顶呢。大家都信仰最大傻瓜理论,觉得自己不是那个大傻瓜。

安心生活

周末出去走走看看世界
看一场电影
看几本书
与朋友游戏几局
平安喜乐就够了

还是决定关闭 blog 了。

太多黑历史,何况还有骂 GCD 的东西。