Skip to content

Commit 022f309

Browse files
committed
style: update some contents
1 parent 6af44d9 commit 022f309

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

GitBook/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
## 2021.12.10
66

77
        加入`HookReposter`
8+
89
       `HookReposter`部署到腾讯云服务器。
10+
911
        增加`GitHub` webhook解析。
12+
1013
        修复`WeWork`hook地址填写错误的问题。
1114

Swift/TheSwiftProgrammingLanguage/Ch01.WelcomeToSwift/ASwiftTour.swift

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let widthLabel = label + String(width)
2323
// do you get?
2424
//
2525
// ANSWER:
26-
// Error: "Binary operator '+' cannot be applied to operands of type 'String'
26+
// Error: "Binary operator '+' cannot be applied to operands of type 'String'
2727
// and 'Int'"
2828

2929
let apples = 3
@@ -41,9 +41,9 @@ let expStr = "Sum of PI and e is \(math_pi + math_e)."
4141
let expGreeting = "Hello, \(author)!"
4242

4343
let quotation = """
44-
I said "I have \(apples) apples."
45-
And then I said "I have \(apples + oranges) pieces of fruit."
46-
"""
44+
I said "I have \(apples) apples."
45+
And then I said "I have \(apples + oranges) pieces of fruit."
46+
"""
4747

4848
var shoppingList = ["catfish", "water", "tulips"]
4949
shoppingList[1] = "bottle of water"
@@ -83,7 +83,7 @@ var optionalName: String? = "John Appleseed"
8383
var greeting = "Hello!"
8484
if let name = optionalName {
8585
greeting = "Hello, \(name)"
86-
} else { // For the EXPERIMENT.
86+
} else { // For the EXPERIMENT.
8787
greeting = "Hello, Modnar!"
8888
}
8989
print(greeting)
@@ -164,7 +164,7 @@ func greet(person: String, day: String) -> String {
164164
greet(person: "Bob", day: "Tuesday")
165165

166166
// EXPEIMENT:
167-
// Remove the `day` parameter. Add a parameter to include today's lunch
167+
// Remove the `day` parameter. Add a parameter to include today's lunch
168168
// special in the greeting.
169169
func greet(person: String, lunch: String) -> String {
170170
return "Hello \(person), today's lunch is \(lunch)!"
@@ -179,7 +179,7 @@ func calculateStatistics(scores: [Int]) -> (min: Int, max: Int, sum: Int) {
179179
var min = scores[0]
180180
var max = scores[0]
181181
var sum = 0
182-
182+
183183
for score in scores {
184184
if score > max {
185185
max = score
@@ -188,7 +188,7 @@ func calculateStatistics(scores: [Int]) -> (min: Int, max: Int, sum: Int) {
188188
}
189189
sum += score
190190
}
191-
191+
192192
return (min, max, sum)
193193
}
194194
let statistics = calculateStatistics(scores: [5, 3, 100, 3, 9])
@@ -253,7 +253,7 @@ class Shape {
253253
return "A shape with \(numberOfSides) sides."
254254
}
255255
// EXPERIMENT:
256-
// Add a constant property with `let`, and add another method that takes an
256+
// Add a constant property with `let`, and add another method that takes an
257257
// argument.
258258
let constVal = 0
259259
func printMessage(message: String) -> String {
@@ -268,29 +268,29 @@ var shapeDescription = shape.simpleDescription()
268268
class NamedShape {
269269
var numberOfSides = 0
270270
var name: String
271-
271+
272272
init(name: String) {
273273
self.name = name
274274
}
275-
275+
276276
func simpleDescription() -> String {
277277
return "A shape with \(numberOfSides) sides."
278278
}
279279
}
280280

281281
class Square: NamedShape {
282282
var sideLength: Double
283-
283+
284284
init(sideLength: Double, name: String) {
285285
self.sideLength = sideLength
286286
super.init(name: name)
287287
numberOfSides = 4
288288
}
289-
289+
290290
func area() -> Double {
291291
return sideLength * sideLength
292292
}
293-
293+
294294
override func simpleDescription() -> String {
295295
return "A square with sides of length \(sideLength)."
296296
}
@@ -301,13 +301,13 @@ test.simpleDescription()
301301

302302
class EquilateraTriangle: NamedShape {
303303
var sideLength: Double = 0.0
304-
304+
305305
init(sideLength: Double, name: String) {
306306
self.sideLength = sideLength
307307
super.init(name: name)
308308
numberOfSides = 3
309309
}
310-
310+
311311
var perimeter: Double {
312312
get {
313313
return 3.0 * sideLength
@@ -316,7 +316,7 @@ class EquilateraTriangle: NamedShape {
316316
sideLength = newValue / 3.0
317317
}
318318
}
319-
319+
320320
override func simpleDescription() -> String {
321321
return "An equilateral triangle with sides of length \(sideLength)."
322322
}
@@ -328,16 +328,16 @@ class EquilateraTriangle: NamedShape {
328328
// `simpleDescription()` method on the `Circle` class.
329329
class Circle: NamedShape {
330330
var radius: Double = 0.0
331-
331+
332332
init(radius: Double, name: String) {
333333
self.radius = radius
334334
super.init(name: name)
335335
}
336-
336+
337337
func area() -> Double {
338338
return 3.14 * radius * radius
339339
}
340-
340+
341341
override func simpleDescription() -> String {
342342
return "A circle with radius \(radius)."
343343
}
@@ -378,7 +378,7 @@ enum Rank: Int {
378378
case ace = 1
379379
case two, three, four, five, six, seven, eight, nine, ten
380380
case jack, queen, king
381-
381+
382382
func simpleDescription() -> String {
383383
switch self {
384384
case .ace:
@@ -411,7 +411,7 @@ if let convertedRank = Rank(rawValue: 3) {
411411

412412
enum Suit {
413413
case spades, hearts, diamonds, clubs
414-
414+
415415
func simpleDescription() -> String {
416416
switch self {
417417
case .spades:
@@ -424,7 +424,7 @@ enum Suit {
424424
return "clubs"
425425
}
426426
}
427-
427+
428428
// EXPERIMENT
429429
// Add a `color()` method to `Suit` that returns "black" for spades and clubs,
430430
// and returns "red" for hearts and diamonds.
@@ -591,8 +591,8 @@ do {
591591
}
592592

593593
// EXPERIMENT:
594-
// Add code to throw an error inside the `do` block. What kind of error do you
595-
// need to throw so that the error is handled by the first `catch` block? What
594+
// Add code to throw an error inside the `do` block. What kind of error do you
595+
// need to throw so that the error is handled by the first `catch` block? What
596596
// about the second and third blocks?
597597
//
598598
// ANSWER:
@@ -615,7 +615,7 @@ func fridgeContains(_ food: String) -> Bool {
615615
defer {
616616
fridgeIsOpen = false
617617
}
618-
618+
619619
let result = fridgeContent.contains(food)
620620
return result
621621
}
@@ -641,8 +641,7 @@ var possibleInteger: OptionalValue<Int> = .none
641641
possibleInteger = .some(100)
642642

643643
func anyCommonElements<T: Sequence, U: Sequence>(_ lhs: T, _ rhs: U) -> Bool
644-
where T.Element: Equatable, T.Element == U.Element
645-
{
644+
where T.Element: Equatable, T.Element == U.Element {
646645
for lhsItem in lhs {
647646
for rhsItem in rhs {
648647
if lhsItem == rhsItem {
@@ -658,8 +657,7 @@ anyCommonElements([1, 2, 3], [3])
658657
// Modify the anyCommonElements(_:_:) function to make a function that returns an
659658
// array of the elements that any two sequences have in common.
660659
func commonElements<T: Sequence, U: Sequence>(_ lhs: T, _ rhs: U) -> [T.Element]
661-
where T.Element: Equatable, T.Element == U.Element
662-
{
660+
where T.Element: Equatable, T.Element == U.Element {
663661
var ans = [T.Element]()
664662
for lhsItem in lhs {
665663
for rhsItem in rhs {

0 commit comments

Comments
 (0)