Skip to content

Instantly share code, notes, and snippets.


Engineer Sheldon Wang SheldonWangRJT

View GitHub Profile
SheldonWangRJT /
Last active August 6, 2022 16:03
iPhone device names, types, resolutions, aspect ratio, scale, PPI

iOS Device Types, Names, Resolutions (points)

iPhone1,1 iPhone 320 x 480 320 x 480 1.5 1.0 163
iPhone1,2 iPhone 3G 320 x 480 320 x 480 1.5 1.0 163
iPhone2,1 iPhone 3GS 320 x 480 320 x 480 1.5 1.0 163
iPhone3,1 iPhone 4 (GSM) 320 x 480 640 x 960 1.5 2.0 326
iPhone3,3 iPhone 4 (CDMA) 320 x 480 640 x 960 1.5 2.0 326
iPhone4,1 iPhone 4S 320 x 480 640 x 960 2.0 1.5 326
SheldonWangRJT /
Created October 15, 2019 00:58
[Git] Create & delete tag (both local and remote)

You can find me by #iOSBySheldon on Github, Facebook, Youtube, etc.

Often used git tag operations

To create and push a tag

Assuming the tag name that we want to create is abc

# to create tag locally
$ git tag abc
SheldonWangRJT /
Last active September 30, 2019 23:39
A Few OpenGL Learning Resources

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.


I have been working with OpenGL ES related stuff in iOS. With Metal taking over iOS GPU rendering, it seems not too smart to start learning if you are very new, however, regardless OpenGL, Metal, they are both doing the similar stuff, which is GPU grapical rendering. If you knew one, you will easily know the other.

This is not a tutorial, it is more like a reference book for myself and u the reader.


  1. GLKit Tutorials (Swift)
SheldonWangRJT /
Last active May 19, 2023 19:06
Shat is the difference among sleep() , usleep() & [NSThread sleepForTimeInterval:]?

#iOSBySheldon #objective-c #swift #unitTest #uiTest #sleep

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

The only reason that I wrote this short quick note is that, the answers on the internet is somewhat misleading.

If we are running sleep() usleep() or [NSThread sleepForTimeInterval:] in your main app, there should not be any difference. Because the first two functions are just functions that from c and the third one is from objective-c.


  • You probably should NOT call them in your main app, because for delay operations you should more use (in Swift)
SheldonWangRJT /
Last active March 8, 2019 21:53
Create local HTTPS server

Create local HTTPS Server

I was required to test some files that have to be hosted under a HTTPS server. Although at the end of the day, I used Azure to deploy a simple webservice, but the process to create a local HTTPS server is still interesting enough to let me write it down.

Notice before you start

There are two things you need to keep in mind before u keep doing this:

  • Although we will be using openssl to create a certificate, it is not a trusted certificate, I don't know if this will fulfil your need of HTTPS or not.
  • It will require sudo, make sure you are admin of your machine
SheldonWangRJT / jack-johnson.json
Last active November 13, 2018 18:28
View jack-johnson.json
"artistName":"Jack Johnson",
SheldonWangRJT / How to write verilog in macOS?.md
Created September 28, 2018 03:31
How to write verilog in macOS? #VHDL #Verilog
View How to write verilog in macOS?.md

Software to use:

  1. terminal app - iverilog
  2. macOS waveform app - GTKWave

iverilog can be download using homebrew. $ brew install icarus-verilog GTKWave can be downloaded here:

To See Waveform in macOS for VHDL

SheldonWangRJT /
Last active October 24, 2019 22:39
iOS/MacOS Tricks to Debug/Detecting Ambiguous Auto Layouts Issues

iOS/MacOS Tricks to Debug/Detecting Ambiguous Auto Layouts Issues

#iOSBySheldon #AutoLayout

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

This time I will bring you some tricks directly from Apple’s document regarding the ways to debug / detecting ambiguous warning (⚠️) for Auto Layouts in iOS and MacOS. To kick things off, I do want mention that Ambiguous Warning for Auto Layout means that the configuration you add into your storyboard or xib file has no conflicts (otherwise it will show ❗️in storyboard). However, it has multiple ways to fulfill your auto layout, so that the system will randomly choose a fine solution to render your view, which maybe correct, maybe wrong, in other words, very inconsistent.

“There are a few methods you can call to help identify ambiguous layouts. All of these methods should be used only for debugging. Set a breakpoint somewhere where you can access the view hierarchy, and then call one of the following methods fr

SheldonWangRJT / How-to-sort-a-List<Object>-in-JAVA?.md
Created July 20, 2018 15:40
How to sort a List<Object> in JAVA in the best way?
View How-to-sort-a-List<Object>-in-JAVA?.md

How to sort a List<Object> in JAVA in a better way / the best way?

This is some notes written by Sheldon. I mainly focused on iOS programming but I also do JAVA and C# backend, you can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

High order functions with lambda is very easy in Swift (see article Here) but not that easy in languages like Objective-C or C++. In JAVA we can do it but since JAVA has too many versions, there are a lot different ways to do it, and there is always a better one you can choose.

Assuming we have a class like:

class Student {
    private int age;
SheldonWangRJT / iOS CPU and GPU
Last active June 17, 2022 03:22
iOS CPU and GPU basics
View iOS CPU and GPU

iOS CPU and GPU basics

#iOSBySheldon #CPU #GPU #60FPS #CADisplayLink

Apple always encourage us as iOS developers to try to maintain our apps running with a 60 frames per second rate (60 FPS) to make sure the best user experience. Most of the time, this comes for free because the hardwares are getting better and better.

But in some cases you may need to dig deeper if your app as a significant frame drops to fix it for the users, which leads to my post today - the basic of CPU and GPU in iOS. Whenever I encounter this kind of question, I always want to find the answer directly from Apple’s official document. I was able to find this article here. I mean this article is written mainly for #Metal and iOS game developers but I found all the info that we need. As always, I will try to summarize the best part of the article.