Skip to content

Commit 61e79b0

Browse files
committed
清理了部分代码
1 parent 0500363 commit 61e79b0

File tree

15 files changed

+240
-360
lines changed

15 files changed

+240
-360
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"Qedo",
88
"Subarrays",
99
"Subsequences",
10+
"TMPL",
1011
"aaleex",
1112
"alicez",
1213
"asdfdfs",
@@ -18,6 +19,9 @@
1819
"chromedp",
1920
"clean",
2021
"count",
22+
"csrf",
23+
"csrfmiddlewaretoken",
24+
"csrftoken",
2125
"ctxt",
2226
"cut",
2327
"domain",
@@ -54,11 +58,13 @@
5458
"return",
5559
"rorse",
5660
"saeed",
61+
"signin",
5762
"split",
5863
"ssaaedd",
5964
"stretchr",
6065
"string",
6166
"strings",
67+
"strs",
6268
"subarray",
6369
"superpalindrome",
6470
"superpalindromes",

Helper/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# helper
22

3-
## 配置方法
4-
53
1.`.gitignore`中,添加一行`*.toml`
64
1.`LeetCode-in-Go`目录下,添加文本文件`config.toml`
75
1. 把以下内容复制到`config.toml`中。
86
1.`config.toml`中的`test`分别修改为你的 leetcode `用户名``密码`
97

108
```toml
11-
Login="test"
9+
Username="test"
1210
Password="test"
1311
```

Helper/config.go

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"fmt"
54
"log"
65

76
"github.com/BurntSushi/toml"
@@ -14,35 +13,18 @@ const (
1413
type config struct {
1514
Username string
1615
Password string
17-
18-
// 以下是电子邮件设置
19-
SMTP string
20-
Port int
21-
From string
22-
To string
23-
EmailPassword string
24-
}
25-
26-
func (c config) String() string {
27-
format := "Username: %s, Password: %s, SMTP: %s, Port: %d, From: %s, To: %s, EmailPassword: %s "
28-
return fmt.Sprintf(format,
29-
c.Username,
30-
c.Password,
31-
c.SMTP,
32-
c.Port,
33-
c.From,
34-
c.To,
35-
c.EmailPassword)
3616
}
3717

3818
func getConfig() *config {
3919
cfg := new(config)
4020

41-
if _, err := toml.DecodeFile(configTOML, &cfg); err != nil {
42-
log.Panicf(err.Error())
43-
}
21+
_, err := toml.DecodeFile(configTOML, &cfg)
22+
check(err)
4423

45-
// log.Printf("get config: %s", cfg)
24+
if cfg.Username == "" {
25+
usage := read("./Helper/README.md")
26+
log.Panicln(string(usage))
27+
}
4628

4729
return cfg
4830
}

Helper/dida.go

Lines changed: 0 additions & 84 deletions
This file was deleted.

Helper/leetcode-get.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

Helper/leetcode-getRanking.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

Helper/leetcode-new.go

Lines changed: 0 additions & 68 deletions
This file was deleted.

Helper/leetcode-algorithms.go renamed to Helper/leetcode-struct.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
package main
22

3-
import (
4-
"encoding/json"
5-
"log"
6-
)
7-
83
// algorithms 保存API信息
94
type algorithms struct {
105
Name string `json:"category_slug"`
@@ -38,21 +33,3 @@ type State struct {
3833
type Difficulty struct {
3934
Level int `json:"level"`
4035
}
41-
42-
func getAlgorithms() *algorithms {
43-
URL := "https://leetcode.com/api/problems/Algorithms/"
44-
45-
raw := getRaw(URL)
46-
47-
res := new(algorithms)
48-
if err := json.Unmarshal(raw, res); err != nil {
49-
log.Panicf("无法把json转换成Category: %s\n", err.Error())
50-
}
51-
52-
// 如果,没有登录的话,也能获取数据,但是用户名,就不是本人
53-
if res.User != getConfig().Username {
54-
log.Fatal("没有获取到本人的数据")
55-
}
56-
57-
return res
58-
}

0 commit comments

Comments
 (0)