CaveOps: Night-City
#Hello Edgerunners, welcome to the Night-City.

Welcome!

Difference between nullable, __nullable and _Nullable in Objective-C

From the Swift blog: This feature was first released in Xcode 6.3 with the keywords __nullable and __nonnull. Due to potential conflicts with third-party libraries, we’ve changed them in Xcode 7 to the _Nullable and _Nonnull you see here. However, for compatibility with Xcode 6.3 we’ve predefined m...
SVG to Data URI Conventer

OS X: Menu Bar Extra is invisible in macOS Dark Mode

周末提交的 APP 又被秒拒, 理由很简单, “Menu Bar Extra is invisible in macOS Dark Mode”, 菜单栏图标在黑色模式中看不到。 由于是第一次用黑白色的图标, 提交之前完全没有考虑到这个问题, 怎么解决呢? 其实很简单。 首先我想到的第一件事是监听, 先试了 NSScreenColorSpaceDidChangeNotification 不起作用, 后来找到了另一个通知: [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(upd...

CentOS: Install Clang

本文主要关于在 CentOS 中安装 Clang 的相关步骤。 (以 CentOS 7 为例) 安装 libstdc++ 如果你正在使用 CentOS 7 及以上的版本,请直接跳过此步骤。 wget https://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ ln -s /opt/rh/devtoolset-2/root...

Ubuntu: Using Swift

本文主要关于在 Ubuntu 中安装和使用 Swift 的相关步骤。 (以 Ubuntu 15.10 为例) 下载 Swift 在 Swift.org 找到并下载对应的 Swift 版本。 解压 Swift $ cd Swift压缩包所在目录的路径 $ tar -xf Swift压缩包文件名.tar.gz $ mv Swift解压后的文件夹名 /swift (最后一句 mv 是为了方便操作,可以省略,/swift 也可以是其它路径) 举个例子: $ cd /home/meniny/Desktop/swift-2.2.1-RELEASE-ubuntu15.10.tar.gz $ tar -x...

OS X: csrutil

El Capitan 加入了 Rootless 机制, 不再能够随心所欲的读写很多路径真是很难过。 Rootless 机制将成为对抗恶意程序的最后防线 要关闭 Rootless, 需要进入恢复系统。开机时按住 option 选择恢复磁盘 (或在开机时按住 command + R), 在菜单中找到并打开 Terminal。 csrutil disable 然后重启即可。 如果要恢复默认: csrutil enable csrutil csrutil enable [--without kext | fs | debug | dtrace | nvram][--no-internal]...

Glücklich ist, wer vergisst, was nicht zu ändern ist.

快乐就是忘记不能改变的事情。

max-height: x% doesn't work on Chrome

Some times using percentages for fluidity in layouts is tricky because you have to deal with containers and border-type things. Look in to using viewport units and learn some thing about it on css-tricks and caniuse will show you how well it's supported. Essentially you can say: <div style="...

Swift: Optional Protocol Methods Without @objc

Objective-C 协议 (protocol) 在 Swift 中是一个特殊的存在, 当你使用 @objc 标记一个协议, LLVM 会生成一系列额外内容: 一个 isa 指针 运行时模块, 例如 __objc_imageinfo、__objc_classref 等 Swift 协议并不支持可选 (optional), 除非我们将协议导出到 Objective-C, 因为这时它们已经变成了 Objective-C 协议。 此外, 这些协议也不能用于扩展 (extension)、枚举 (enum) 和结构体 (struct), 作用十分有限, 如果你在 Linux 环境下使用 Swift...

Cocoa: Change Cursor

The way to change the cursor when it's over an NSButton: First, you should subclass NSButton first, then add the code below: @property (strong) NSCursor *cursor; - (void)resetCursorRects { if (self.cursor) { [self addCursorRect:[self bounds] cursor: self.cursor]; } else { ...

CSS Selectors Level 4

关于 CSS Selectors Level 4 阶段性新特性的总结。 Negation pseudo-class :not :not 用于将符合规则的元素剔除, 将样式规则应用于其他元素上。 在 CSS3 中已经有 :not, 不过在 CSS3 中只能使用简单的匹配规则, 例如 :not(p) 用来选择不是 <p> </p> 的元素。 在 CSS4 中, 可以应用更复杂的匹配规则, 但是同样地不允许嵌套使用, 例如 :not(:not(...))。 .negation { color: black; } .negation .default:not([data...

Cocoa: Sending mail via Python

偶然看到一个讨论, 需求很简单, 单纯的 SMTP 邮件发送。 这样的话我想 Python 应该是一个不错的选择, 那么首先我们需要写一个 Python 程序, 我们将它保存为 mail.py: import os import smtplib import json from email import Encoders from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart from email.Utils im...

What's this?

The Night-City version of CaveOps inspired by Cyberpunk 2077. Not finished yet.

Pinned Message

The Founder and CEO of Infeca Technology.

Developer, Designer, Blogger.

Big fan of Apple, Love of colour.

Feel free to contact me.

反曲点科技创始人和首席执行官。

开发、设计与写作皆为所长。

热爱苹果、钟情色彩。

随时恭候 垂询