Skip to content

Instantly share code, notes, and snippets.

View ChrisRisner's full-sized avatar

Chris Risner ChrisRisner

View GitHub Profile
- (IBAction)tapPostPOI:(id)sender {
UIImage *image = imageView.image;
NSData *data = UIImagePNGRepresentation(image);
//Just pass the call over to our generic serviceCaller
[serviceCaller postToUrl:sasURL
withBody:data andPostType:@"PUT" andContentType:@"image/jpeg" withCallback:^(NSString *response) {
//This is the callback code that the ServiceCaller will call upon success
labelSasUrl.text = response;
if ([response isEqualToString:@""])
@ChrisRisner
ChrisRisner / Constants.h
Created September 14, 2012 18:36
GeoDemo-ios3
@interface Constants : NSObject
#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
extern NSString *kGetPOIUrl;
extern NSString *kGetSASUrl;
extern NSString *kAddPOIUrl;
extern NSString *kContainerName;
@end
- (void)fetchedData:(NSData *)responseData {
NSError* error;
//Build a JSON object from the response Data
NSArray* json = [NSJSONSerialization
JSONObjectWithData:responseData //1
options:kNilOptions
error:&error];
//Go through each POI in the JSON data and pull out the important fields
@ChrisRisner
ChrisRisner / Constants.h
Created September 14, 2012 05:48
GeoDemo-ios1
#import <Foundation/Foundation.h>
@interface Constants : NSObject
#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
extern NSString *kGetPOIUrl;
@end
/** This method will create a test container for use in our client side code **/
/** Code from http://blogs.msdn.com/b/brian_swan/archive/2010/07/08/accessing-windows-azure-blob-storage-from-php.aspx **/
/** Note that we're defaulting the container name to 'test' **/
$app->match('/api/Location/AddTestContainer', function () use ($app){
$storageClient = new Microsoft_WindowsAzure_Storage_Blob('blob.core.windows.net', STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY);
try {
if($storageClient->isValidContainerName('test')) {
if(!$storageClient->containerExists('test')) {
$result = $storageClient->createContainer('test');
@ChrisRisner
ChrisRisner / AddPoi
Created September 10, 2012 22:23
GeoDemo
/** Adds a new SLUG to the DB (and file) */
public function addPOI($description, $type, $url, $latitude, $longitude, $id) {
//Add to DB
$con = mysql_connect($this->db_server,$this->db_user,$this->db_password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($this->db_name, $con);
@ChrisRisner
ChrisRisner / ViewController.h
Last active October 10, 2015 06:57
31 Days of iOS - Day 3
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *lblInfo;
@property (weak, nonatomic) IBOutlet UITextField *txtText;
- (IBAction)tappedClickMe:(id)sender;
@end
@ChrisRisner
ChrisRisner / Data Types
Created September 4, 2012 04:18
Intro to ObjectiveC
//Using Pointers
NSDictionary *myDictionary = ...
//Not using Pointers
NSDictionary myDictionary = ...
@ChrisRisner
ChrisRisner / AndroidManifestOne
Created August 31, 2012 06:47
Todos Part two
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.msdpe.mymobileservice"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@drawable/ic_launcher"
@ChrisRisner
ChrisRisner / Constants
Created August 31, 2012 05:55
Android Todos Part 1
public class Constants {
public static final String kGetTodosUrl = "https://yoursubdomain.azure-mobile.net/tables/TodoItem?$filter=(complete%20eq%20false)";
public static final String kAddTodoUrl = "https://yoursubdomain.azure-mobile.net/tables/TodoItem";
public static final String kUpdateTodoUrl = "https://yoursubdomain.azure-mobile.net/tables/TodoItem/";
public static final String kMobileServiceAppId = "YourAppKey";
}