This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
extension DateFormatter.Style { | |
static public var allCases: [DateFormatter.Style] = [ | |
.none, | |
.short, | |
.medium, | |
.long, | |
.full, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
let formatter = DateFormatter() | |
formatter.dateStyle = .long | |
formatter.dateFormat = "(O) VVV" | |
formatter.locale = Locale(identifier: "zh") | |
TimeZone.knownTimeZoneIdentifiers | |
.compactMap(TimeZone.init(identifier:)) | |
.map { timeZone -> String in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"User_na": "A", | |
"Total": "a", | |
"Scene_No": "1" | |
}, | |
{ | |
"User_na": "B", | |
"Total": "b", | |
"Scene_No": "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
extension Calendar { | |
func isDateIn7days(from date: Date) -> Bool { | |
let date1 = self.startOfDay(for: Date()) | |
let date2 = self.startOfDay(for: date) | |
let days = (date1 - date2).day ?? 0 | |
return days <= 8 && days > 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Strapdown.js - Instant and elegant Markdown documents</title> | |
<!-- 🌙 Dark theme--> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/dark.min.css"> | |
<link rel="stylesheet" href="https://raw.githack.com/google/code-prettify/master/styles/desert.css"> | |
<!-- 🌞 Light theme--> | |
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/light.min.css"> --> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A Cocoa based Playground to present user interface | |
import AVFoundation | |
let voices = AVSpeechSynthesisVoice.speechVoices().reduce([String:[AVSpeechSynthesisVoice]]()) { (result, voice) -> [String:[AVSpeechSynthesisVoice]] in | |
var voices = result | |
let locale = Locale(identifier: voice.language) | |
let code = locale.localizedString(forLanguageCode: locale.languageCode!) ?? "??" | |
var voiceOnLanguage = voices[code] ?? [] | |
voiceOnLanguage.append(voice) | |
voices[code] = voiceOnLanguage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Locale { | |
var flagCode: String { | |
guard let country = self.regionCode else {return "🌐"} | |
let base : UInt32 = 127397 | |
let code = country.unicodeScalars.compactMap{UnicodeScalar(base + $0.value)} | |
return String(String.UnicodeScalarView(code)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var charLayers = [CAShapeLayer]() | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
for layer in self.charLayers { | |
layer.removeFromSuperlayer() | |
} | |
let stringAttributes = [ NSAttributedString.Key.font: UIFont(name: "Zapfino", size: 32.0)! ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# project 為你的專案名 | |
project="wushark" | |
# 下載 mochiweb 並 建立你的專案 | |
git clone git://github.com/mochi/mochiweb.git | |
cd mochiweb && make app PROJECT=$project && cd .. | |
git init $project | |
cd $project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 博迪先生死於謀殺, | |
% 現有六個嫌疑犯, | |
% 每個人在不同的房間, | |
% 每間房間各有一件可能的凶器,但不知道嫌疑犯、房間、凶器的對應關系。請根據下面的條件和線索,找出誰是凶手。 | |
% 已知條件: | |
% 六個嫌疑犯是三男 喬治、約翰、羅伯特;三女 芭芭拉、克里斯汀、約蘭達。 | |
男人(喬治). 男人(約翰). 男人(羅伯特). | |
女人(芭芭拉). 女人(克里斯汀). 女人(約蘭達). |