Skip to content

Instantly share code, notes, and snippets.

//yahoo weather
NSLog(@"%@", [YahooAPI yahooAPIWeatherWithWOEID:@"12703518"]);
NSLog(@"%@", [YahooAPI yahooAPIWeatherWithWOEID:@"12703518" unit:YAHOO_WEATHER_UNIT_CELSIUS]);
NSLog(@"%@", [YahooAPI yahooAPIWeatherWithWOEID:@"12703518" unit:YAHOO_WEATHER_UNIT_FAHRENHEIT]);
//yahoo woeid
NSLog(@"%@", [YahooAPI yahooAPIWOEIDWithLatitude:25.049826 Longitude:121.572586]);
NSLog(@"%@", [YahooAPI yahooAPIWOEIDWithAddress:@"台北市大安區敦化南路二段267號"]);
@IskenHuang
IskenHuang / AddressBook.m
Created December 17, 2012 09:33
Grant iOS AddressBook permission
-(void) grantAddressBook{
// Request authorization to Address Book
ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);
if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
// First time access has been granted, add the contact
[self getContentList:addressBookRef];
});
}
@IskenHuang
IskenHuang / gist:4255734
Created December 11, 2012 03:39
multiple target in the same project
#ifdef LITE
//lite version
//your code here
#else
//not lite version(i.e. pro)
//your code here
#endif
//-------------------------------------------------------------
@IskenHuang
IskenHuang / CheckNetWork.h
Created October 3, 2012 01:28
iOS-CheckNetWork
//
// CheckNetWork.h
//
//
// Created by Isken Huang on 11/13/10.
// Copyright 2010 Isken Huang. All rights reserved.
//
#import <netinet/in.h>
#import <SystemConfiguration/SCNetworkReachability.h>
@IskenHuang
IskenHuang / app.js
Created September 26, 2012 03:10
Nodejs file upload
app.post('/upload', function(req, res){
data = req.body;
// get the temporary location of the file
console.log('file => '+req.files);
var tmp_path = req.files.file.path;
// set where the file should actually exists - in this case it is in the "images" directory
var target_path = './public/images/'+ req.files.file.name;
// move the file from the temporary location to the intended location
console.log('tmp_path = '+tmp_path+' || target_path = '+target_path);