Skip to content

Instantly share code, notes, and snippets.

@MrFuFuFu
MrFuFuFu / ViewController.swift
Created May 24, 2020 06:04
NSKeyedUnarchiver.unarchivedObject has Font issues
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var editText: UITextView!
@IBOutlet weak var showText: UITextView!
var attText: NSMutableAttributedString {
get {
let a = NSAttributedString(string: "这是非粗体\n", attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white])
let b = NSAttributedString(string: "这是粗体\n", attributes: [NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white])
@MrFuFuFu
MrFuFuFu / gist:c7c4d0c93ba5f2626af0
Last active January 11, 2016 11:52 — forked from SmartDengg/gist:b48ee0a83db2b36dd79f
Draft: Writing Code for Production

Writing Resilient Reactive Applications

This guide is a first draft (that will end up in the official docs) on writing resilient code for production with the Couchbase Java SDK. At the end, the reader will be able to write code that withstands bugs, latency issues or anything else that can make their application fail.

Note that lots of concepts can be applied for both synchronous and asynchronous access. When necessary, both patterns are discussed separately. Also, the focus is on database interaction, but if you are using RxJava as part of your stack you can apply most of the principles there as well (and should!).

RxJava 101 Recap: Cold and Hot Observables

When working with Observables, it is important to understand the difference between cold and hot. Cold Observables will start to emit events once a Observer subscribes, and will do it "fresh" for each Observer. Hot Observables instead are starting to emit data as soon as it becomes available, and will return the same (or parts of the same)