Swift Reading Notes: The Basics

Swift is a newprogramming language for iOS, macOS, watchOS, and tvOS app development. Nonetheless, many parts of Swift will be familiar from your experience of developing in C and Objective-C.

Constants and Variables

If a stored value in your code is not going to change, always declare it as a constant with the let keyword. Use variables only for storing values that need to be able to change.

let maximumNumberOfLoginAttempts = 10
var currentLoginAttempt = 0”

Continue reading “Swift Reading Notes: The Basics”


Spacemacs All Personal Keybindings

This is my Spacemacs personal config on Github: https://github.com/ztlevi/Spacemacs-config

Common Stuffs

In key bindings, M stands for Alt key (option key for mac), s for Command key, C for Control key, SPC for Space key.

Key Bindings Description
C-g Quit
C-o Open Action panel when mini dired enabled
C-h k/v/f/d Key/ variable/ function/ Documentation
C-h C-k/v/f Find key/ variable/ function
C-h e Show Emacs’s errors
SPC SPC (M-x) eval-buffer, customize-group
SPC e n Js2-next-error
s-/ Comment
SPC j i Imenu (show all the functions)
SPC v Expand Region
SPC x o Open link
C-q Insert Quote (C-m ^M, C-j newline). There are functions to edit the ^M, replace-dos-eol, hidden-dos-eol, remove-dos-eol
SPC s e iedit: need to select in vim-visual mode, and then press the key to edit them.
s-C Color picker in mac
SPC ? List key bindings
SPC ‘ Pop default shell (eshell)

Continue reading “Spacemacs All Personal Keybindings”

Publish with Org2Blog and Solution to non-ascii when posting to Wordpress

Install packages

Install org2blog. I put the package in my own emacs configuration folder. Path to org2blog: ~/.spacemacs.d/layers/org2blog/.

org2blog depends on

  1. xml-rpc available at Launchpad Launchpad
  2. metaweblog.el available here

To better manage the packages, I just put the two packages above right under the same path to my org2blog.

Configuring Emacs

Put following code in your emacs configuration file, e.g. ~/.emacs.d/init.el. Of course, change to your private infomation, including my-blog, url, username. You need to put /xmlrpc.php after your url. That’s for XML-RPC server of your homepage. It only accepts POST request.

Continue reading “Publish with Org2Blog and Solution to non-ascii when posting to Wordpress”