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 | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
class A { // Taskでselfを使わないパターン | |
var task: Task<Void, Error>? | |
init() { |
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 Cow<Food> { | |
class Stomach { | |
var food: Food? = nil | |
func copy() -> Stomach { | |
let stomach = Stomach() | |
stomach.food = food | |
return stomach | |
} | |
} |
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
func getFilename(_ string: StaticString) -> String { | |
guard string.hasPointerRepresentation else { | |
return String(string.unicodeScalar) | |
} | |
var index = string.utf8CodeUnitCount | |
while index > 1 { | |
index -= 1 | |
let pointer = string.utf8Start + index | |
if UnicodeScalar(pointer.predecessor().pointee) == "/" { |
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
func os_signpost(_ event: String) { | |
print(event) | |
} | |
@_functionBuilder public struct Measure { | |
public static var buildBlock: (_: Any...) -> Void { | |
os_signpost("start") | |
return { (_: Any...) -> Void in | |
os_signpost("end") | |
} |
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
query { | |
search(type: REPOSITORY, query: "js sort:stars", first: 5) { | |
nodes { | |
... on Repository { | |
nameWithOwner | |
} | |
} | |
} | |
} |
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 bash | |
if [[ $# < 1 ]]; then | |
echo "USAGE: $0 PATTERNS" | |
exit 1 | |
fi | |
IFS=$'\n' | |
for PATTERN in "$@"; do | |
STATUS=$(git status $PATTERN --porcelain) |
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
// | |
// Graph.swift | |
// CoreMesh | |
// | |
// Created by Akio Yasui on 10/24/15. | |
// Copyright © 2015 Akio Yasui. All rights reserved. | |
// | |
import Foundation |
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
for FRAMEWORK in `\find Carthage/Build/iOS/ -name "*.framework"`; do | |
PLIST=$FRAMEWORK/Info.plist | |
grep "<string>com.firebase.Firebase</string>" $PLIST >/dev/null | |
if [ $? = 0 ]; then | |
NAME=$(basename $FRAMEWORK .framework) | |
echo "Replacing bundle identifier of $NAME" | |
plutil -replace CFBundleIdentifier -string "com.firebase.Firebase.$NAME" $PLIST | |
fi | |
done |
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 | |
public protocol Reusable: class { | |
static var reuseIdentifier: String { get } | |
} | |
extension UITableViewCell: Reusable { | |
public static var reuseIdentifier: String { | |
return NSStringFromClass(self) | |
} |
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
http https://slack.com/api/users.list token==$SLACK_TOKEN | jq ".members[].id" | xargs -I{} http https://slack.com/api/channels.invite token==$SLACK_TOKEN channel==$SLACK_CHANNEL user=={} |
NewerOlder