Skip to content

Instantly share code, notes, and snippets.

View kingcos's full-sized avatar
📲
Busy for work.

kingcos kingcos

📲
Busy for work.
View GitHub Profile
@kingcos
kingcos / xcode_tips.sh
Created October 13, 2020 15:58
Xcode Tips
# https://github.com/ctreffs/xcode-defaults
# 显示 Xcode 构建时间
defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
@kingcos
kingcos / active_count_in_app_store_connect.js
Created October 21, 2019 06:23
Calculate the active count in App Store Connect
function active_count_lower_than(target_version) {
target_version = target_version
.split(".")
.map(e => {
if (e.length < 2) {
return "0" + e;
} else {
return e;
}
})
//
// ViewController.m
// KVOC
//
// Created by kingcos on 2019/3/24.
// Copyright © 2019 kingcos. All rights reserved.
// This is the demo code for my question:
// https://stackoverflow.com/questions/55321440/do-i-have-to-removeobserver-in-kvo-manually-now
//
@kingcos
kingcos / wechat_send.go
Last active December 11, 2018 03:06
企业微信发送文本信息脚本(Enterprise WeChat Text Message Script)
// Powered by github.com/kingcos
// Reference: https://github.com/kingcos/gitlab-mr-watchdog
// Usage:
// 1. ⏬ Download it
// 2. 🔧 `go build wechat_send.go`
// 3. 🏁 `./wechat_send -text "Hello" -users "A,B,C"`
// 4. 🎉 A, B, & C received "Hello" message
package main
@kingcos
kingcos / SwiftyJSBridge.html
Last active November 15, 2018 09:21
JavaScript demo of github.com/kingcos/SwiftyJSBrdge.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SwiftyJSBridge</title>
</head>
<body></body>
<script>
var url = 'scheme://host?param1=value1&param2=value2';
var iframe = document.createElement('iframe');
func random(in range: Range<Int>) -> Int {
return Int(arc4random_uniform(UInt32(range.count))) + range.lowerBound
}
for _ in 0..<5 {
let range = Range<Int>(1...6)
print(random(in: range))
}
import UIKit
// 通过类型取出某个实例方法的签名,再传入实例调用相应的方法
class ClassA {
func method(_ number: Int) -> Int {
return number + 1
}
}
// func1: (ClassA) -> (Int) -> Int
import UIKit
func addTo(_ adder: Int) -> (Int) -> Int {
return {
num in
return num + adder
}
}
func greaterThan(_ comparer: Int) -> (Int) -> Bool {

Keybase proof

I hereby claim:

  • I am kingcos on github.
  • I am kingcos (https://keybase.io/kingcos) on keybase.
  • I have a public key whose fingerprint is F1E0 1ED3 52B2 D711 0C92 3075 2CF7 B598 ABCC A55E

To claim this, I am signing this object: