Skip to content

Instantly share code, notes, and snippets.

@cute
cute / gist:8c08df76fdeae2d1146bc67e52a8b205
Created October 28, 2024 10:23 — forked from joaofranca/gist:3159618
gist 7: iOS - Customize UITableViewCell delete/move overlay views while editing
- (void)layoutSubviews{
[super layoutSubviews];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.0f];
for (UIView *subview in self.subviews) {
@cute
cute / BackdeployedWidgetAccentedRenderingMode.swift
Created October 15, 2024 08:03 — forked from ABashkirova/BackdeployedWidgetAccentedRenderingMode.swift
iOS 18 Widgets: Notes about updating the widget
import SwiftUI
import WidgetKit
@available(iOS, deprecated: 18.0, message: "use WidgetAccentedRenderingMode instead")
enum BackdeployedWidgetAccentedRenderingMode {
case accented
case accentedDesaturated
case desaturated
case fullColor
@cute
cute / BackdeployedWidgetAccentedRenderingMode.swift
Created October 15, 2024 08:03 — forked from ABashkirova/BackdeployedWidgetAccentedRenderingMode.swift
iOS 18 Widgets: Notes about updating the widget
import SwiftUI
import WidgetKit
@available(iOS, deprecated: 18.0, message: "use WidgetAccentedRenderingMode instead")
enum BackdeployedWidgetAccentedRenderingMode {
case accented
case accentedDesaturated
case desaturated
case fullColor
@cute
cute / is_connected_to_vpn.swift
Created December 30, 2023 11:16 — forked from azwan082/is_connected_to_vpn.swift
Check if iOS app is connected to VPN
func isConnectedToVpn() -> Bool {
let host = "www.example.com"
guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else {
return false
}
var flags = SCNetworkReachabilityFlags()
if SCNetworkReachabilityGetFlags(reachability, &flags) == false {
return false
}
let isOnline = flags.contains(.reachable) && !flags.contains(.connectionRequired)
@cute
cute / .gitignore
Created October 16, 2023 09:33 — forked from jirihnidek/.gitignore
Example of (Linux) client-server aplication using ECN bit in UDP packets.
.cproject
.project
build
@cute
cute / ios-default-fontsize-table.swift
Created October 15, 2023 11:52 — forked from christianklotz/ios-default-fontsize-table.swift
List of default font sizes for dynamic type
let defaultFontSizeTable = [
UIFontTextStyleHeadline: [
UIContentSizeCategoryAccessibilityExtraExtraExtraLarge: 26,
UIContentSizeCategoryAccessibilityExtraExtraLarge: 25,
UIContentSizeCategoryAccessibilityExtraLarge: 24,
UIContentSizeCategoryAccessibilityLarge: 24,
UIContentSizeCategoryAccessibilityMedium: 23,
UIContentSizeCategoryExtraExtraExtraLarge: 23,
UIContentSizeCategoryExtraExtraLarge: 22,
UIContentSizeCategoryExtraLarge: 21,
@cute
cute / openssl-build.sh
Created September 1, 2023 06:45 — forked from felix-schwarz/openssl-build.sh
Updated script that builds OpenSSL for OS X, iOS and tvOS. Bitcode enabled for iOS, tvOS. Updated to build for tvOS, use the latest SDKs, skip installing man pages (to save time), download the OpenSSL source over HTTPS, patch OpenSSL for tvOS to not use fork(). Currently requires Xcode7.1b or later (for the tvOS SDK).
#!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
@cute
cute / endian.h
Created December 13, 2022 05:03 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@cute
cute / StickyHeadersCollectionViewFlowLayout.m
Created September 20, 2022 10:06 — forked from megakode/StickyHeadersCollectionViewFlowLayout.m
A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
// StickyHeadersCollectionViewFlowLayout
//
// A subclass of UICollectionViewFlowLayout which has UITableView style sticky headers.
//
// This code is based on Evadne Wu's code^1, with the following changes:
//
// * Fixes a crash for sections with zero items
// * Adds support for UIScrollView's contentInset
// * Adds support for UICollectionViewFlowLayout's sectionInset
//
@cute
cute / nf_check.js
Created August 24, 2022 10:13 — forked from Hyseen/nf_check.js
Netflix 解锁检测模块
/**
*
* [Panel]
* nf_check = script-name=nf_check, title="Netflix 解锁检测", content="请刷新", update-interval=1
*
* [Script]
* nf_check = type=generic, script-path=https://gist.githubusercontent.com/Hyseen/b06e911a41036ebc36acf04ddebe7b9a/raw/nf_check.js?version=1633074636264, argument=title=Netflix 解锁检测
*
* 支持使用脚本使用 argument 参数自定义配置,如:argument=key1=URLEncode(value1)&key2=URLEncode(value2),具体参数如下所示,
* title: 面板标题