Skip to content

Instantly share code, notes, and snippets.

View happymanx's full-sized avatar

HappyMan happymanx

View GitHub Profile
@johnny77221
johnny77221 / openBLESetting
Created October 24, 2016 07:07
opening iOS BLE setting from app
NSURL *bluetoothURLOS8 = [NSURL URLWithString:@"prefs:root=General&path=Bluetooth"];
NSURL *bluetoothURLOS9 = [NSURL URLWithString:@"prefs:root=Bluetooth"];
NSURL *bluetoothURLOS10 = [NSURL URLWithString:@"Prefs:root=Bluetooth"];
if ([[[UIDevice currentDevice] systemVersion] intValue] >= 10) {
Class<NSObject> workSpaceClass = NSClassFromString(@"LSApplicationWorkspace");
if (workSpaceClass) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
id workSpaceInstance = [workSpaceClass performSelector:NSSelectorFromString(@"defaultWorkspace")];
SEL selector = NSSelectorFromString(@"openSensitiveURL:withOptions:");
@happymanx
happymanx / Display Image.cpp
Last active February 24, 2017 03:41
[OpenCV] Display Image
/**
Theme: Display Image
IDE: Xcode 7, OSX 10.10
Language: C++, OpenCV 2.4.12
Date: 104/12/04
Author: HappyMan
Blog: http://cg2010studio.wordpress.com/
*/
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@noelrocha
noelrocha / open_app.html
Created March 16, 2015 18:28
Open app on Google Play or AppStore
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Open App</title>
<!--
URL Params:
customSchemeURL: Your custom scheme app
@joemasilotti
joemasilotti / About.md
Last active February 25, 2016 22:16
NSDate Manipulation in iOS 8

This gist accompanies the blog post NSDate Manipulation Made Easy in iOS 8.

Apple quietly introduced a whole new suite of public API methods to NSCalendar in iOS 8 titled “Calendrical Calculations”. For some reason they seemed to have forgotten to include them in the public documentation on their developer site. Fortunately, digging in to the header file in Xcode reveals lots of descriptive comments about how to use these powerful new ways of interacting with NSDate objects.

@matsuda
matsuda / NSData+AES.h
Created February 25, 2014 07:14
Objective-C code for encrypt and decrypt by AES-128 encryption.
/**
http://mythosil.hatenablog.com/entry/20111017/1318873155
http://blog.dealforest.net/2012/03/ios-android-per-aes-crypt-connection/
*/
@interface NSData (AES)
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key;
- (NSData *)AES128DecryptedDataWithKey:(NSString *)key;
- (NSData *)AES128EncryptedDataWithKey:(NSString *)key iv:(NSString *)iv;
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}