Skip to content

Instantly share code, notes, and snippets.

View karosLi's full-sized avatar
🎯
Focusing

Karosli karosLi

🎯
Focusing
View GitHub Profile
@karosLi
karosLi / SheetModalPresentationController.swift
Created January 16, 2021 09:57 — forked from vinczebalazs/SheetModalPresentationController.swift
A presentation controller to use for presenting a view controller modally, which can be dismissed by a pull down gesture. The presented view controller's height is also adjustable.
import UIKit
extension UIView {
var allSubviews: [UIView] {
subviews + subviews.flatMap { $0.allSubviews }
}
func firstSubview<T: UIView>(of type: T.Type) -> T? {
allSubviews.first { $0 is T } as? T
@karosLi
karosLi / index.html
Created October 23, 2019 08:56
iphone-inline-video demo with playsinline // source https://jsbin.com/batetip/1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>iphone-inline-video demo with playsinline</title>
</head>
<body>
<video loop playsinline autoplay="autoplay" id="video1" muted="muted" poster="http://image.baby-kingdom.com/images2/2016/b/html5/wyeth_20161122_320x280/poster.jpg" type="video/mp4" width="100%" src="http://image.baby-kingdom.com/images2/2016/b/html5/wyeth_20161122_320x280/video.mp4">
</video>
@karosLi
karosLi / 判断代码是否在扩展里执行
Last active May 5, 2018 02:59
判断代码是否在扩展里执行
+#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && !defined(AF_APP_EXTENSIONS)
- (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler; - (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler;
#endif #endif
@karosLi
karosLi / YYImage+LKUIKit.m
Created January 17, 2018 13:16
YYImage 支持传入 bundle
//
// YYImage+LKUIKit.m
// LKUIKit
//
// Created by karos li on 2018/1/17.
// Copyright © 2018年 karos. All rights reserved.
//
#import "YYImage+LKUIKit.h"