Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Engineer Sheldon Wang SheldonWangRJT

🎯
Focusing
Block or report user

Report or block SheldonWangRJT

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SheldonWangRJT
SheldonWangRJT / iPhone_device_names_types_resolutions.md
Last active Nov 11, 2019
iPhone device names, types, resolutions, aspect ratio, scale, PPI
View iPhone_device_names_types_resolutions.md

iOS Device Types, Names, Resolutions (points)

DEVICE TYPE PRODUCT NAME RESOLUTION (PIXEL) UIKIT SIZE (POINT) ASPECT RATIO (H:W) UIKIT SCALE PIXEL PER INCH (PPI)
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
SheldonWangRJT / tag_operations.md
Created Oct 15, 2019
[Git] Create & delete tag (both local and remote)
View tag_operations.md

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
SheldonWangRJT / OpenGL_larning_resources.md
Last active Sep 30, 2019
A Few OpenGL Learning Resources
View OpenGL_larning_resources.md

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

About

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.

Tutorials

  1. GLKit Tutorials (Swift)
@SheldonWangRJT
SheldonWangRJT / sleep_in_ios.md
Last active Sep 30, 2019
Shat is the difference among sleep() , usleep() & [NSThread sleepForTimeInterval:]?
View sleep_in_ios.md

#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.

However,

  • You probably should NOT call them in your main app, because for delay operations you should more use (in Swift)
View CreateLocalHTTPSServer.md

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
View jack-johnson.json
{
"resultCount":50,
"results":[
{
"wrapperType":"track",
"kind":"song",
"artistId":909253,
"collectionId":879273552,
"trackId":879273565,
"artistName":"Jack Johnson",
@SheldonWangRJT
SheldonWangRJT / How to write verilog in macOS?.md
Created Sep 28, 2018
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: http://gtkwave.sourceforge.net/

To See Waveform in macOS for VHDL

@SheldonWangRJT
SheldonWangRJT / iOS-MacOS-Tricks-to-Debug-Detecting-Ambiguous-Auto-Layouts-Issues.md
Last active Oct 24, 2019
iOS/MacOS Tricks to Debug/Detecting Ambiguous Auto Layouts Issues
View iOS-MacOS-Tricks-to-Debug-Detecting-Ambiguous-Auto-Layouts-Issues.md

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
SheldonWangRJT / How-to-sort-a-List<Object>-in-JAVA?.md
Created Jul 20, 2018
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;
View iOS CPU and GPU basics.md

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.

You can’t perform that action at this time.