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
//: Playground - noun: a place where people can play | |
import UIKit | |
var json: String = """ | |
{ | |
"result": { | |
"persons": [ | |
{ |
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
@ViewBuilder | |
private func build<#name#>(_ viewStore: ViewStoreType) -> some View { | |
} |
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
// Type-Erasure | |
// - seealso: [AnyIterator](https://github.com/apple/swift/blob/2fe4254cb712fa101a220f95b6ade8f99f43dc74/stdlib/public/core/ExistentialCollection.swift.gyb#L45) | |
// MARK: remove `Equatable` if not needed | |
public protocol Protocol: Equatable { | |
// MARK: `Protocol` requirements | |
associatedtype AssociatedType | |
func methodOfProtocol() -> Self.AssociatedType | |
} |
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
-- Thank @sbengo to figure out foreign_keys constraints is defaults to false in sqlite | |
-- Enable to delete logs by cascading delete | |
PRAGMA foreign_keys = ON; | |
WITH n_build_ids_per_repo as ( | |
SELECT build_id | |
FROM ( | |
SELECT | |
build_id, | |
build_repo_id, |
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
echo '[{"key": 1}, {"key": 2}, {"key": 1}]' | jq 'group_by (.key)[] | {key: .[0].key, length: length}' |
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 UIKit | |
import PlaygroundSupport | |
/* | |
Let g(N) be the count of numbers that contain a 7 when you write out all the numbers from 1 to N. | |
g(7) = 1 | |
g(20) = 2 | |
g(70) = 8 | |
g(100) = 19 |
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
## 首次使用 Git LFS | |
# 安裝 Git LFS CLI | |
brew install git-lfs | |
# 在 repo 位置下 | |
git lfs install | |
## 設定 Git LFS 自定義位址 | |
git config -f .lfsconfig lfs.url http://<UserName>@<SERVER>:3000/<User>/<Project>.git/info/lfs |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>lfs-server</string> | |
<key>ProgramArguments</key> | |
<array><string>/Users/gitea/gitea</string></array> | |
<key>RunAtLoad</key> | |
<true/> |
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
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" | |
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash \ | |
-v file-log-from-apple-review.crash \ | |
XXXX.xcarchive/dSYMs/XXXX.app.dSYM/ > output.log |
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
# e.g. | |
# echo '[{"a":1, "b":2}, {"a":3, "b":4}]' | jq '.[]' | |
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' |
NewerOlder