Category Archives: Mac


Adding the codefunction to .zshrc file: function code { if [[ $# = 0 ]] then open -a "Visual Studio Code" else local argPath="$1" [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}" open -a "Visual Studio Code" "$argPath" fi … Continue reading

Posted in Mac | Tagged , | Leave a comment

CommentPlus for Swift Func

Usage reference: Download the Xcode extension from here Unzip and double click the extension to install the extension In Xcode, put the cursor on the upper line of func, then select Xcode menu bar: Editor -> CommentGenerator -> … Continue reading

Posted in iOS, Mac | Tagged | Leave a comment

How to generate **.cer** and **.p12** file for iOS push notification

Every time I created a new app with push notifications, iOS, I'm sure I've got everything right and then something refused to work. So this time I'm writing it down so I can't possibly get it wrong again.  Generally, … Continue reading

Posted in iOS, Mac, Mobile | Tagged , , , | 1 Comment

How to use Android Battery Historian

1. Install Docker: 2. Run Docker docker run -p 5001:9999 –port 9999 3. Fetch battery report To obtain a bug report from your development device running Android 7.0 and higher: $ adb bugreport For devices 6.0 and … Continue reading

Posted in Android, Mac, Mobile | 1 Comment

Calculate LOC by shell script

Navigating to you project folder, run(python project) find . -name “*.py” |xargs grep -v “^$”|wc -l If it is a Objective-C project, the the script should look like this: find . -name “*.m” -or -name “*.h” |xargs grep -v “^$”|wc … Continue reading

Posted in Mac, Mobile | Leave a comment

Adding an existing project to GitHub using the command line

Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub. Open Terminal. Change the current working … Continue reading

Posted in git, Mac, Mobile | Leave a comment

RAM Disk on Mac

原文链接: 实现方法 方法的思路很简单,大概可以分两步: 1.配置 RAM。在内存中专门开出一块让 Xcode 使用。 2.连接 Xcode。让 Xcode 连接到我们开辟出来的专属内存空间。 下面就是见证奇迹的时刻。 第一步, 创建 .sh 文件。代码如下 #!/bin/bash RAMDISK=”ramdisk” SIZE=1024 #size in MB for ramdisk.· diskutil erasevolume HFS+ $RAMDISK `hdiutil attach -nomount ram://$[SIZE*2048]` 第二步, 运行 .sh 文件。在命令行中敲下 之后你会发现你会多出一个叫 ramdisk 的内存空间,有大概 1 … Continue reading

Posted in Mac | Leave a comment