Skip to content

Instantly share code, notes, and snippets.

@tjluoma
tjluoma / macos-is-at-least.sh
Last active Jul 30, 2020
zsh script to compare macOS Versions - see https://rhymeswithdiploma.com/2020/07/10/macos-is-at-least/ for full explanation
View macos-is-at-least.sh
#!/bin/zsh -f
# Purpose: Check to see if we are running on Big Sur
#
# From: Timothy J. Luoma
# Mail: luomat at gmail dot com
# Date: 2020-07-10
PATH="/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin"
# this will check to make sure `sw_vers` exists
@SergLam
SergLam / UIDevice+Ext.swift
Created Jun 14, 2019
Detect iOS device model
View UIDevice+Ext.swift
public extension UIDevice {
enum DeviceModelName: String {
case undefined
case iPodTouch5
case iPodTouch6
case iPhone4
case iPhone4s
case iPhone5
View WWDC.2019.Combine.kvo.swift
@available(iOS 13.0, *)
func exampleCombineKVO () {
let article = Article(title: "Test", body: "Lorum ipsum")
// For a KeyPath 101, see https://www.swiftbysundell.com/posts/the-power-of-key-paths-in-swift
let keypath: ReferenceWritableKeyPath<Article,String> = \.title
// The new Combine stuff:
let sink = Subscribers.Assign(object: article, keyPath: keypath)
let source = Publishers.Future<String, Never> { subscriber in
View CodeTextField.swift
import UIKit
class CodeTextField: UITextField, UITextFieldDelegate {
let codeLength: Int
var characterSize: CGSize
var characterSpacing: CGFloat
let textPreprocess: (String) -> String
let validCharacterSet: CharacterSet
@novemberfiveco-gists
novemberfiveco-gists / WKCookieWebView.swift
Last active Aug 27, 2020
A WKWebView subclass that passes cookies after a 302 redirect response.
View WKCookieWebView.swift
//
// WKCookieWebView.swift
//
// Created by Jens Reynders on 30/03/2018.
// Copyright (c) 2018 November Five
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View gist:97e9e3d60c39ce4aac647a77534d4ebf
@implementation AppHostCookie
+ (NSMutableArray<NSString *> *)cookieJavaScriptArray
{
NSMutableArray<NSString *> *cookieStrings = [[NSMutableArray alloc] init];
//取出cookie
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
@Jpoliachik
Jpoliachik / index.ios.js
Last active Feb 26, 2020
ReactNative LayoutAnimation Example
View index.ios.js
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
View SRCopyableLabel.swift
//
// SRCopyableLabel.swift
//
// Created by Stephen Radford on 08/09/2015.
// Copyright (c) 2015 Cocoon Development Ltd. All rights reserved.
//
import UIKit
class SRCopyableLabel: UILabel {
View WhyRSS
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Subscriptions - WHY</title>
</head>
<body>
<outline text="cool" title="cool">
<outline htmlUrl="http://kedebug.com/" title="kedebug" xmlUrl="http://kedebug.com/atom.xml" type="rss" text="kedebug"/>
<outline htmlUrl="http://lucida.me/" title="Lucida" xmlUrl="http://lucida.me/atom.xml" type="rss" text="Lucida"/>
<outline htmlUrl="http://www.alloyteam.com" title="Web前端 腾讯AlloyTeam Blog | 愿景: 成为地球卓越的Web团队!" xmlUrl="http://www.alloyteam.com/feed/" type="rss" text="Web前端 腾讯AlloyTeam Blog | 愿景: 成为地球卓越的Web团队!"/>
@ryanhanwu
ryanhanwu / build.config
Last active Jul 9, 2019
My iOS IPA build script for XCode workspace with CocoaPods installed
View build.config
#Code Sign
PRODUCT_NAME="MyApp"
WORKSPACE_NAME=$PRODUCT_NAME
SCHEME_NAME=$PRODUCT_NAME
DEVELOPER_NAME="iPhone Developer: XXXXXXXX (2CA66F8Y8L)"
PROVISONNING_PROFILE_DEBUG="profile/OOO.mobileprovision"
PROVISONNING_PROFILE_RELEASE="profile/XXXXX.mobileprovision"
You can’t perform that action at this time.