Skip to content

Instantly share code, notes, and snippets.

View sTinGe's full-sized avatar
🐶
howl~

Wei-Long Su sTinGe

🐶
howl~
View GitHub Profile
@sTinGe
sTinGe / index.js
Last active August 29, 2015 14:12 — forked from edokeh/index.js
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@sTinGe
sTinGe / PhotoLibraryHelper.swift
Created February 12, 2018 02:14
default photo library for iOS camera roll
// Created by SuStinge on 12/02/2018.
import UIKit
import Foundation
import AVFoundation
import MobileCoreServices
class PhotoLibraryHelper: NSObject {
public static let imagePicker = UIImagePickerController()
fileprivate let isPhotoLibraryAvailable = UIImagePickerController.isSourceTypeAvailable(.photoLibrary)
fileprivate let sourceTypePhotoAlbum = UIImagePickerControllerSourceType.photoLibrary
@sTinGe
sTinGe / CameraHelper.swift
Last active February 12, 2018 02:14
default imagePicker for iOS camera
// Created by SuStinge on 12/02/2018.
import UIKit
import Foundation
import AVFoundation
import MobileCoreServices
class CameraHelper: NSObject {
public static let imagePicker = UIImagePickerController()
fileprivate let isCameraAvailable = UIImagePickerController.isSourceTypeAvailable(.camera)
@interface NSNotificationCenter : NSObject {
@package
void *_impl;
void *_callback;
void *_pad[11];
}
@property (class, readonly, strong) NSNotificationCenter *defaultCenter;
// addObserver
void CFNotificationCenterAddObserver(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior);
// postNotificationName
void CFNotificationCenterPostNotification(CFNotificationCenterRef center, CFNotificationName name, const void *object, CFDictionaryRef userInfo, Boolean deliverImmediately);
// removeObserver
void CFNotificationCenterRemoveObserver(CFNotificationCenterRef center, const void *observer, CFNotificationName name, const void *object);
- (void) viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
}
- (void) triggeredObserver {
[[NSNotificationCenter defaultCenter] postNotificationName:UIKeyboardWillShowNotification object:nil userInfo:nil];
}
- (void) dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
}
#include <stdio.h>
#define price double
#define PRINT(x) printf("macro: %f", x);
int main() {
price p = 12.3;
PRINT(p);
return 0;
}
#define CLASSNAME(x) NSStringFromClass([x class])
NSLog(@"NSString:%@", CLASSNAME([NSString string]));
NSLog(@"NSMutableString:%@", CLASSNAME([NSMutableString string]));
#undef CLS