This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sleep(_ time: Double) { | |
usleep(UInt32(time * 1000000)) | |
} | |
func debug(_ strings: Any...) -> some View { | |
var string = "" | |
for component in strings { | |
string += "\(component)" + " " | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <mach/mach_time.h> | |
#define StopWatchStart() uint64_t startTime = mach_absolute_time() | |
#define StopWatchEnd(caption) uint64_t elapsed = mach_absolute_time() - startTime; static mach_timebase_info_data_t sTimebaseInfo; if ( sTimebaseInfo.denom == 0 ) { (void) mach_timebase_info(&sTimebaseInfo); } uint64_t elapsedNano = elapsed * sTimebaseInfo.numer / sTimebaseInfo.denom / 1000000; DLog(@"%s: %qu ms\n", caption, elapsedNano) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
{ | |
public: | |
A(int n): m_n(n){} | |
int GetNumber() const { return m_n; } | |
operator int() const { return GetNumber(); } | |
protected: | |
int m_n; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Version 2.0 (updated for Xcode 4, with some fixes) | |
# Changes: | |
# - Works with xcode 4, even when running xcode 3 projects (Workarounds for apple bugs) | |
# - Faster / better: only runs lipo once, instead of once per recursion | |
# - Added some debugging statemetns that can be switched on/off by changing the DEBUG_THIS_SCRIPT variable to "true" | |
# - Fixed some typos | |
# | |
# Purpose: | |
# Create a static library for iPhone from within XCode | |
# Because Apple staff DELIBERATELY broke Xcode to make this impossible from the GUI (Xcode 3.2.3 specifically states this in the Release notes!) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL QuickSavePic( Bitmap* pBitmap, const CString& strFilename ) | |
{ | |
CString strExt = strFilename.Mid( strFilename.ReverseFind( NEVER_TRANSLATE('.') ) + 1 ); | |
strExt.MakeUpper(); | |
CString strFormat; | |
if ( strExt == NEVER_TRANSLATE("JPG") ) strFormat = NEVER_TRANSLATE("image/jpeg"); | |
if ( strExt == NEVER_TRANSLATE("JPEG") ) strFormat = NEVER_TRANSLATE("image/jpeg"); | |
if ( strExt == NEVER_TRANSLATE("GIF") ) strFormat = NEVER_TRANSLATE("image/gif"); | |
if ( strExt == NEVER_TRANSLATE("PNG") ) strFormat = NEVER_TRANSLATE("image/png"); |