Skip to content

Instantly share code, notes, and snippets.

View imdp6's full-sized avatar
🏅
Focusing

imdp6 imdp6

🏅
Focusing
View GitHub Profile
import Foundation
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors.
/// Instead of remembering to keep `self` as weak in a stored closure:
///
/// ```swift
/// // MyClass.swift
/// var onDone: (() -> Void)?
/// func done() {
/// onDone?()
class ViewController: UIViewController {
@objc
func clickButton() {
//get the button frame
/* 1 */
let button = UIButton.init(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
/* 2 */
//Configure the presentation controller
let popoverContentController = BViewController()
@imdp6
imdp6 / Delegate.swift
Created August 8, 2021 01:07 — forked from onevcat/Delegate.swift
An auto-weak delegate for handle modern delegate pattern.
import Foundation
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors.
/// Instead of remembering to keep `self` as weak in a stored closure:
///
/// ```swift
/// // MyClass.swift
/// var onDone: (() -> Void)?
/// func done() {
/// onDone?()
@imdp6
imdp6 / git_toturial
Created June 16, 2018 04:44 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@imdp6
imdp6 / luna_pinyin.custom.yaml
Created April 1, 2018 10:13 — forked from lotem/luna_pinyin.custom.yaml
在【朙月拼音】裏使用Emoji表情
# luna_pinyin.custom.yaml
#
# 在【朙月拼音】裏使用Emoji表情
#
# 保存到Rime用戶文件夾後,重新部署生效
# ~/.config/ibus/rime (linux)
# ~/Library/Rime (macos)
# %APPDATA%\Rime (windows)
#
# 如果目標文件已經包含其他修改內容,只需按照縮進合併 patch: 以下的部分