โโโ app
โ โโโ controllers
โ โ โโโ admin
โ โ โ โโโ posts.js
โ โ โ โโโ users.js
โ โ โโโ posts.js
โ โ โโโ session.js
#!/bin/bash | |
# | |
# git-mv-with-history -- move/rename file or folder, with history. | |
# | |
# Moving a file in git doesn't track history, so the purpose of this | |
# utility is best explained from the kernel wiki: | |
# | |
# Git has a rename command git mv, but that is just for convenience. | |
# The effect is indistinguishable from removing the file and adding another | |
# with different name and the same content. |
// USAGE: | |
// Call RestorationDefender.printViewControllerClassesThatAreProbablyNotRestorable() to print a list of view controllers that will probably not return from state restoration. | |
// Call RestorationDefender.crashWhenViewControllersDoNotImplementStateRestoration() to crash your app when a view controller appears without setting restorationIdentifier and restorationClass. | |
// Call RestorationDefender.shoutWhenViewControllersDoNotImplementStateRestoration() to print a big message when a view controller appears without setting restorationIdentifier and restorationClass. | |
import Foundation | |
private func objc_getClassList() -> [AnyClass] { | |
let expectedClassCount = objc_getClassList(nil, 0) | |
var allClasses = UnsafeMutablePointer<AnyClass?>.alloc(Int(expectedClassCount)) |
so A and B are structurally identical | |
C reverses the order of the 8 and 32 bit Ints | |
and D substitutes a string for the Int8 | |
then I try to read aaaaโs bits using B C and D overlays ๐ | |
C is printing the 8 bits of the A integer j and then the first 8 bits of integer k but somehow that still works out to one | |
when I hit D it doesnโt find a string so prints a blank | |
but the important point is: it doesnโt check anything, and doesnโt crash |
import Foundation | |
func withCStrings(_ strings: [String], scoped: ([UnsafeMutablePointer<CChar>?]) throws -> Void) rethrows { | |
let cStrings = strings.map { strdup($0) } | |
try scoped(cStrings + [nil]) | |
cStrings.forEach { free($0) } | |
} | |
enum RunCommandError: Error { | |
case WaitPIDError |
https://swift.org/documentation/api-design-guidelines/
-
์ฌ์ฉํ ๋ ๊ธฐ์ค์ผ๋ก ๋ช ํํ๊ฒ ์์ฑํ๋ ๊ฒ ๊ฐ์ฅ ์ค์ํ ์งํฅ์ ์ด๋ค. ๋ฉ์๋๋ ํ๋กํผํฐ ๊ฐ์ ๊ฐ๋ฐ ์์๋ ํ ๋ฒ๋ง ์ ์ธํ๊ณ ๋ฐ๋ณต์ ์ผ๋ก ์ฌ์ฉํ๋ค. API๋ฅผ ๋ง๋ค ๋๋ ์ฌ์ฉํ๊ธฐ ๋ช ํํ๊ณ ํธํ๊ฒ ๋ง๋ค์ด์ผ ํ๋ค. ์ค๊ณ๋ฅผ ๊ฒ์ฆํ ๋ ์ ์ธ ๋ถ๋ถ์ ์ฝ๋ ๊ฒ๋ง์ผ๋ก๋ ๋ถ์กฑํ๋ค. ๊ทธ ๋์ ์ฌ์ฉํ๋ ์ํฉ์์ ๋งฅ๋ฝ์ ๋ง๊ณ ๋ช ํํ ์ง ๋ ๊ณ ๋ คํด์ผ ํ๋ค.
-
๋ช ํํ ํํ์ด ์์ถํ ๊ฐ๊ฒฐ์ฑ๋ณด๋ค ๋ ์ค์ํ๋ค. ์ค์ํํธ ์ฝ๋๋ ์์ถํด์ ๊ฐ๊ฒฐํ๊ฒ ์์ฑํ ์ ์์ง๋ง, ๋จ์ง ๊ธ์์๋ฅผ ์ค์ฌ์ ๊ฐ์ฅ ์งง์ ์ฝ๋๋ฅผ ๋ง๋๋ ๊ฒ ๋ชฉํ๋ ์๋๋ค. ์ค์ํํธ ์ฝ๋์ ๊ฐ๊ฒฐ์ฑ์ ์์ฐ์ค๋ฝ๊ฒ ๋ฐ๋ณต์ ์ผ๋ก ์ฌ์ฌ์ฉํ๋ ์ฝ๋(boilerplate)๋ฅผ ์ค์ด๋ ๊ธฐ๋ฅ๊ณผ ๊ฐํ ํ์ ์์คํ ์ ๋ถ์ํจ๊ณผ๋ก ๋๋ฌ๋ ๋ฟ์ด๋ค.
import UIKit | |
private func isExcluded(_ kind: AnyClass) -> Bool { | |
let name = String(describing: kind) | |
return (name.count > 2 && name.prefix(2) == "UI") || | |
(name.count > 3 && name.prefix(3) == "_UI") | |
} | |
extension UIControl { | |
override open var accessibilityIdentifier: String? { |
import Foundation | |
class ReadValue { | |
var successClosure : ((String)->())? = nil | |
var value : String = "" { | |
didSet { | |
if let closure = successClosure { | |
closure(value) | |
} | |
} | |
} |
class ReadValue { | |
private var thread : Thread? = nil | |
init(with handler: @escaping (String) -> ()) { | |
thread = Thread(block: { | |
while(true) { | |
let value = readLine() ?? "" | |
handler(value) | |
} | |
}) | |
thread?.start() |
- Read DataLoader Source
- Check out Keechma's Dataloader and Graphql Builder... (video)
- Check out this example with GraphQL + Express + Dataloader