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 locationAccessAllowed = NO; | |
if( [CLLocationManager instancesRespondToSelector:@selector(locationServicesEnabled)] ) | |
{ | |
// iOS 3.x and earlier | |
locationAccessAllowed = locationManager.locationServicesEnabled ; | |
} | |
else if( [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)] ) | |
{ | |
// iOS 4.x | |
locationAccessAllowed = [CLLocationManager locationServicesEnabled] ; |
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
NSArray *parameters = [[url query] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"=&"]]; | |
NSMutableDictionary *keyValueParm = [NSMutableDictionary dictionary]; | |
for (int i = 0; i < [parameters count]; i=i+2) { | |
[keyValueParm setObject:[parameters objectAtIndex:i+1] forKey:[parameters objectAtIndex:i]]; | |
} |
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
# | |
# Copyright (c) 2001, 2002 Swedish Institute of Computer Science. | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without modification, | |
# are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, | |
# this list of conditions and the following disclaimer. | |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
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
# | |
# Copyright (c) 2001, 2002 Swedish Institute of Computer Science. | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without modification, | |
# are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, | |
# this list of conditions and the following disclaimer. | |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
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
// | |
// SideMenuViewController.m | |
// MFSideMenuDemo | |
// | |
// Created by Michael Frederick on 3/19/12. | |
#import "ANSideMenuController.h" | |
#import "MFSideMenu.h" | |
#import "ANGlobalStreamController.h" | |
#import "ANUserStreamController.h" |
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
- (void)addItemsOnBottom | |
{ | |
// [self.tableView reloadData]; | |
// | |
// if (items.count > 50) | |
// self.canLoadMore = NO; // signal that there won't be any more items to load | |
// else | |
// self.canLoadMore = YES; | |
NSLog(@"%@", [[streamData lastObject] objectForKey:@"post_id"]); |
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
NSString *resourcePath = [bundleFiles objectAtIndex:indexPath.row]; | |
NSString *resourceType = [resourcePath pathExtension]; | |
NSString *resource = [resourcePath stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@".%@",resourceType] withString:@""]; | |
NSString *path = [[NSBundle mainBundle] pathForResource:resource ofType:resourceType]; |
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
// get sample rate of the default input device | |
OSStatus MyGetDefaultInputDeviceSampleRate(Float64 *outSampleRate) | |
{ | |
OSStatus error; | |
AudioDeviceID deviceID = 0; | |
// get the default input device | |
AudioObjectPropertyAddress propertyAddress; | |
UInt32 propertySize; | |
propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; |
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
-(void) playMusic | |
{ | |
NSString *musicPath1 = [[NSBundle mainBundle] pathForResource:@"POL-stable-boy-short" ofType:@"wav"]; | |
NSString* musicPath2 = [[NSBundle mainBundle] pathForResource:@"POL-two-fat-gangsters-short" ofType:@"wav"]; | |
AVPlayerItem *firstMusicItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:musicPath1]]; | |
AVPlayerItem *secondMusicItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:musicPath2]]; | |
self.backgroundMusicPlayer = [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObjects:firstMusicItem, secondMusicItem, nil]]; | |
for (;;) |
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
-(IBAction)sliderValueChanged:(id)sender { | |
UISlider *currentSlider = (UISlider*)sender; | |
NSString *initalJSONRequest = [NSString stringWithFormat:@"{\"on\":\"true\""]; | |
NSString *jsonRequest; | |
if (currentSlider == self.brightnessSlider) { | |
self.brightnessValueLabel.text = [NSString stringWithFormat:@"%f", currentSlider.value]; | |
jsonRequest = [initalJSONRequest stringByAppendingFormat:@",\"bri\":%.0f}", currentSlider.value]; | |
} |
OlderNewer