Skip to content

Instantly share code, notes, and snippets.

View jebai0521's full-sized avatar
🎯
Focusing

Chen Ming jebai0521

🎯
Focusing
View GitHub Profile
@jebai0521
jebai0521 / mfc_app_singleton_C++
Created January 5, 2017 07:13 — forked from thinkhy/mfc_app_singleton_C++
mfc 应用程序的单例运行
BOOL InitInstance()
{
m_hMutex = ::CreateMutex(NULL, FALSE, APP_MUTEX_NAME);
if (NULL == m_hMutex)
{
Suicide();
return FALSE;
}
@jebai0521
jebai0521 / geo.md
Last active August 29, 2015 14:20 — forked from benbahrenburg/geo.md

Fixing Geo Location Permissions in iOS8

In iOS8, Apple has changed how geo location permissions work. This gist outlines an approach to fix this so Geo will continue to work in iOS8.

Before getting started with the code change, we need to update the tiapp.xml with a few keys.

If you wish to have Geo always run, you need to add the below key. The key NSLocationAlwaysUsageDescription is used when requesting permission to use location services whenever the app is running. To enable this, add the below to the tiapp.xml:

NSLocationAlwaysUsageDescription Reason that appears in the authorization prompt

/**
* Link against MobileGestalt
*/
OBJC_EXTERN CFStringRef MGCopyAnswer(CFStringRef property) WEAK_IMPORT_ATTRIBUTE;
void someFunction() {
CFStringRef udid = MGCopyAnswer(CFSTR("UniqueDeviceID"));
/*
@jebai0521
jebai0521 / index.js
Created January 13, 2014 08:50 — forked from FokkeZB/index.js
function doClick(e) {
alert('Clicked!');
}
// Remove the event listener like this:
// $.myWidget.off("click", doClick);
$.index.open();