Skip to content

Instantly share code, notes, and snippets.

View akkyie's full-sized avatar

Akio Yasui akkyie

View GitHub Profile
import Cocoa
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class A { // Taskでselfを使わないパターン
var task: Task<Void, Error>?
init() {
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) == "/" {
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")
}
@akkyie
akkyie / cow.swift
Last active November 13, 2020 05:29
struct Cow<Food> {
class Stomach {
var food: Food? = nil
func copy() -> Stomach {
let stomach = Stomach()
stomach.food = food
return stomach
}
}
@akkyie
akkyie / repository.gql
Created June 27, 2019 16:01
GitHub v4 Search
query {
search(type: REPOSITORY, query: "js sort:stars", first: 5) {
nodes {
... on Repository {
nameWithOwner
}
}
}
}
#!/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)
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
import UIKit
public protocol Reusable: class {
static var reuseIdentifier: String { get }
}
extension UITableViewCell: Reusable {
public static var reuseIdentifier: String {
return NSStringFromClass(self)
}
@akkyie
akkyie / slack-invite-everyone-into-a-channel.sh
Last active July 28, 2017 10:00
Invite everyone into a channel
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=={}

Keybase proof

I hereby claim:

  • I am akkyie on github.
  • I am akkyie (https://keybase.io/akkyie) on keybase.
  • I have a public key ASDgjjWxhAHPALmC9WROabnuPheUwItBj2UlRbB3SJaUaAo

To claim this, I am signing this object: