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
// public class Namespace { // OK | |
// public final class Namespace { // NG | |
// public struct Namespace { // NG | |
public enum Namespace { // NG | |
open class T1 { | |
private func test1() {} | |
fileprivate func test2() {} | |
} | |
} |
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
struct Cat { | |
let name: String | |
let age: Int | |
} | |
let cat1 = "jiji" | |
let cat2 = Cat(name: "jiji", age: 13) | |
print("name: \(cat1)") // name: jiji | |
print("name: \(cat2)") // name: Cat(name: "jiji", age: 13) |
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 Foundation | |
protocol Size { static var value: Int { get } } | |
enum N: Size { static let value = Int(ProcessInfo.processInfo.environment["ARRAY_SIZE_N"]!)! } |
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 | |
extension UIViewController { | |
public func present( | |
_ viewController: UIViewController, | |
with transitioningDelegate: UIViewControllerTransitioningDelegate, | |
completion: (() -> Void)? = nil | |
) { | |
viewController.transitioningDelegate = transitioningDelegate | |
viewController.modalPresentationStyle = .custom |
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
if executable('swim') | |
autocmd InsertLeave * :call system('swim use com.apple.keyboardlayout.all') | |
endif |
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
#!/usr/bin/env python3 | |
# coding: utf-8 | |
from collections import namedtuple | |
Crumb = namedtuple('Crumb', ('key', 'value')) | |
def run(args): |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
def main(args): | |
for p in walk(args.path, pattern='.*\.swift$'): | |
format(p, args.indent_width) | |
def format(path, indent_width): |
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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application( | |
application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]? | |
) -> Bool { |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
from typing import Optional | |
class Uint(object): | |
def __new__(c, value: int) -> 'Optional[Uint]': | |
if value < 0: | |
return None | |
else: |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
from typing import Generic | |
from typing import Optional | |
from typing import TypeVar | |
T = TypeVar('T') | |
class Box(Generic[T]): |