This is the twelfth episode of the fourth season of The Big Bang Theory. The episode is called “The Bus Pants Utilization”.
In this episode they develop an application for iOS to calculate equations from photos taken.
The code that appears is an Objective-C code of an iOS app. I believe that this code was written specially for the episode.