Luminoid's Site

OK Computer

Setup

Remove storyboard: Link
gitignore

Package

Package Manager

SPM

Common Packages

SnapKit

A Swift Autolayout DSL for iOS & OS X

Kingfisher

A lightweight, pure-Swift library for downloading and caching images from the web.

RxSwift

Reactive Programming in Swift

R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects

Tools

UI

Lookin

You can inspect and modify views in iOS app via Lookin, just like UI Inspector in Xcode, or another app called Reveal.

Code

SwiftLint

A tool to enforce Swift style and conventions.

SwiftFormat

SwiftFormat is a code library and command-line tool for reformatting Swift code on macOS, Linux or Windows.

Build

Xcode-Build-Server

This repo aims to integrate xcode with sourcekit-lsp and support all the languages (swift, c, cpp, objc, objcpp) xcode supports, so I can develop iOS with my favorate editor.

xcbeautify

xcbeautify is a little beautifier tool for xcodebuild.

Read more »

Official Site: https://hexo.io/
Version: 8.1.0

Workflow

With Git deployment

1
2
3
4
5
6
7
$ hexo new "My New Article"
# Edit source/_posts/My-New-Article.md
$ hexo clean
$ hexo generate
$ git add -A
$ git commit -m <msg>
$ git push

Maintenance

Update outdated npm packages:

Using npm: With npm-check-updates. Run the following commands under the blog directory (./).

1
2
$ ncu -u
$ npm install

Configuration

Site config is stored in ./_config.yml

Read more »

Programs for getting the nth Fibonacci number in different programming languages.

C (1972)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>

int fib(int n) {
if(n <= 1) {
return n;
}

int a = 0;
int b = 1;

for(int i = 2; i <= n; i++) {
int c = a + b;
a = b;
b = c;
}
return b;
}

int main(int argc, char *argv[]) {
int n = atoi(argv[1]);
printf("fib(%d) = %d\n", n, fib(n));
return 0;
}
1
2
3
$ gcc fibonacci.c
$ ./a.out 1
fib(1) = 1
Read more »

Mac Usage

Mac Usage

Awesome Mac

Shell

Zsh Usage

Package Manager

Homebrew

Installation

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Commands

1
2
3
4
5
6
7
8
9
10
11
12
13
brew install <formula>      # Install formula.
brew install --cask <cask> # Install cask.
brew update # Fetch the newest version of Homebrew and all formulae from GitHub.
brew upgrade # Upgrade outdated casks and outdated, unpinned formulae.
brew leaves # List installed formulae that are not dependencies of another installed formula.
brew tap # Tap a formula repository.
brew doctor # Check your system for potential problems.
brew cleanup # Remove stale lock files and outdated downloads for all formulae and casks, and remove old versions of installed formulae.

# List installed leaf packages by size
brew leaves | while read pkg; do
du -sh "$(brew --cellar)/$pkg" 2>/dev/null | sed "s|$(brew --cellar)/||"
done | sort -hr

npm

Installation

1
brew install node

Yarn

Installation

1
brew install yarn

CocoaPods

Installation

1
sudo gem install cocoapods
Read more »

Usage

Start REPL.

1
node

Check current supported ES6 features.

1
node --v8-options | grep harmony

Version Management

n

Installation

1
brew install n

Usage

1
2
3
n               # Display downloaded Node.js versions and install selection
sudo n latest # Install the latest Node.js release (downloading if necessary)
sudo n lts # Install the latest LTS Node.js release (downloading if necessary)

Package Manager

npm-check-updates

Amend a commit

1
git commit --amend

Git pull till a particular commit

1
2
git fetch remote <branch_name>
git merge <commit_hash>

Your branch and ‘origin/master’ have diverged

1
2
git fetch origin
git reset --hard origin/master

Remove all unreachable objects

Warning

This command would remove all stashed objects.

1
2
git reflog expire --expire-unreachable=now --all
git gc --prune=now
Read more »

Packages Upgrade and Check

1
2
3
4
5
6
7
8
$ bubu          # brew update && brew outdated && brew upgrade && brew cleanup
$ brew doctor

$ ncu -g
$ npm doctor

$ gem update
$ gem cleanup

Keyboard Shortcuts

Mac keyboard shortcuts

Common Shortcuts

Command-,: Open preferences for the front app
Shift-Command-T: Reopen the last closed tab
Shift-Command-[: Switch to previous tab
Shift-Command-]: Switch to next tab

Finder Shortcuts

Shift-Command-.: Toggle show hidden files

System Shortcuts

Option–Volume Up / Option–Volume Down: Open Sound preferences.
Option–Shift–Volume Up / Option–Shift–Volume Down: Adjust the sound volume in smaller steps.
Option–Brightness Up / Option–Brightness Down: Open Displays preferences.
Option–Shift–Brightness Up / Option–Shift–Brightness Down: Adjust the display brightness in smaller steps.
Control-Command-Q: Immediately lock your screen.

Document Shortcuts

Option–Left: Move the insertion point to the beginning of the previous word
Option–Right: Move the insertion point to the end of the next word
Option-Delete: Delete the word to the left of the insertion point
Control-A: Move to the beginning of the line or paragraph
Control-E: Move to the end of the line or paragraph

0%