Hello World, I'm chechin

About me

I’m chechin. I majored in Mould Injection in university, but I also had a good appetite for learning coding. My dream is creating some little games like the flash game in the past time I growed up.

This is The First Post I Wrote

I’m going to write something in English. I’m afraid I could not update this blog every day. English is not my native language, but I will try my best to express what I want to say.

My First Project - a Real Web Game

I’ve already completed a little project by myself.
It’s a complicated tic-tac-toe game.
This is my CS50 final project. Yes, I got the certificate, finally.

Here’s my github and there’s build the game on gh-pages and you can play the game immediately.

More info and the rules detail in the manual text in the following link.

This is the project link on GitHub

I’m going to make a multiply connect system, and a beautiful tutorial.

This is just the modify the first post

I modified the first default post “hello word”, so this post is really basic, just have a chance to write something.Hope I will have time to record the problem I met in CS50, and others before.

These are the websites I read. Really easy to read.
Markdown Guild

And I installed this extension to preview markdown
Markdown Preview Enhanced

DailyLog

This is a backlog to record what I do everyday.
Update at before and after working.

2021/5/31 week targets:

  • ttt’s preloading bar
  • ttt’s tutorial
  • ttt’s castle text
  • learn git
  • ttt’s online play systeam
  • daily leetcode note

2021/5/31 target:

  • ttt’s preloading bar (completed and added logo)

    tutorial from GameDev Academy

  • ttt’s tutorial (x)
  • emergency task: rewrite resume (x)
  • leetcode 3. (x)

2021/5/31 target:

  • ttt’s tutorial (x)
  • rewrite resume(2/3)
  • leetcode 3. (x)

2.two_sum

Two Sum

hint: x = target - y
hint: use hash map

Objects vs. Maps

helper func:

  • map.get(key) = value
  • Using map[key] will return undefined. It different from an object.
  • map.has(key) = boolean

|
|
|
|
|
|
|
|
|

1
2
3
4
5
6
7
8
9
10
11
function twoSum(nums: number[], target: number): number[] {
let hash = new Map;
for (let i = 0; i < nums.length; i++) {
const secondNum: number = target - nums[i];
if (hash.has(secondNum)) {
return [hash.get(secondNum), i];
}
hash.set(nums[i], i);
}

};

Sign's Name in Code

Why I write this post

When I want to google some problem, I don’t know how to express my question. And google always can not type the sign. English is not my mother tongue so I made this table and will upgrade when I learn the new one.

I used markdown generator to help me make the table.

sign name
^ caret
! tilde
* asterisk
\ backslash
$ dollar
_ underscore
` backtick
| pipe
{} curly braces(brackets)
[] (square) brackets
<> angle brackets
() parentheses
# hash, pound, sharp
+ plus
- minus, hyphen
. dot
! exclamation mark
? question mark
% percent

First Hexo

This is my first time using hexo. I’m trying to record what I did. I will not talk about the details like how to make a template or something. Just talk about installing and deploying on gh-pages.

Here’s some websites you may need.
Hexo’s official site

I’ve already install the Node.js and git
I used yarn just like npm but faster (using npm is just do the same things)

Just like the official tutorial installing, I use
npm instal hexo-cli -g
(I still didn’t understand how to yarn global to command line, so just use npm here)
(2021.05.30 I knew how to set global command line, will make a new post to talk about this)
Then open the folder with VScode. It may be an empty folder now.
And enter yarn install in your terminal.
Now, there should be something in this folder.
Could check the details of these in the official web if you want.

We still do not deploy the blog on gh-pages and this is just like creating an app to help you generate the static website.

Let’s deploy to the gh-pages

Use the One-Command Deployment
I spent a lot of time trying to know the official deployment, but I couldn’t understand. So why not use this convenient tool?

First install the hexo-deployer-git.
npm install hexo-deployer-git

I forgot to say the git repository name should be
username.github.io

Edit _config.yml in your folder. It’s empty on the deploy config now.

1
2
deploy:
type:

change to

1
2
3
4
5
deploy:
type: git
repo: https://github.com/wcc356/wcc356.github.io
branch: gh-pages
message: "Site updated: {{ now('YYYY-MM-DD HH:mm:ss') }}"

The repo is the repository you built.

yarn build or hexo generate
Now, we build a static website.

And we can deploy the website to gh-pages now
use
yarn deploy or hexo deploy
There’s no difference between these two commands, yarn deploy is just a method to execute the hexo deploy, check the ‘package.json’ file in your folder.

1
2
3
4
5
6
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},

This is the script when you use yarn "scripts_name" what is going to happen. Don’t change the file if you don’t need it.(if use npm will be npm run 'scripts_name')

Finally, check your website on your github-pages. Sometimes it may take several sec.
Just use the generate and deploy every time you update the new post or change the template, or more complicated things I still don’t know.


The first version site will no update, but I will not delete it as a experience.

2021.5.29 update
Finally, I know what the official website text means.
I Only have to push my all hexo files to one repo (the official’s branch is source but this is just a convention, mine is named main lol)

check your folder connect to the repo then

the step 4 on hexo gh-pages text

setting the CI workflow on the git.
It means when you push to the branch then do these things automatically.
(CI = continuous Integration)

Add .github/workflows/pages.yml file to your repo with the following content:
Just copy these text to your new file which just made

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
name: Pages

on:
push:
branches:
- source # default branch


jobs:
pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: master # deploying branch

The only two variable you need to change is

  1. source should be your own branch name when you pushed
    means when you push then do the following work.
1
2
3
4
on:
push:
branches:
- main
  1. publish_branch is your deploy branch.
    I changed it to gh-pages, just up to you
1
2
3
4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: gh-pages

Long story short, the one command deployed is just for someone who doesn’t want to other’s read his hexo files(like templates or something).