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
Use like this: | |
NSData* fileData = UIImageJPEGRepresentation(profileImage, 0.8f); | |
NSMutableURLRequest *request = [self.httpClient requestWithMethod:@"POST" path:@"api/users/updateSettings" parameters:params]; | |
[self setupMultipartRequest:request withParams:params data:fileData dataName:@"profileImage"]; | |
-(void) setupMultipartRequest:(NSMutableURLRequest *) request withParams:(NSDictionary *) params data:(NSData *) data dataName:(NSString *) dataName { | |
//Add the header info | |
NSString *stringBoundary = @"0xKhTmLbOuNdArY"; |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
require 'net/https' | |
require 'uri' | |
if ARGV.length != 2 | |
puts "Usage: makeBranch.rb SPRINT_NUMBER PT_ID" | |
else | |
urlString = 'https://www.pivotaltracker.com/services/v5/stories/'+ARGV[1] |
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
fetchRequest.entity = [RNPFeedListEntry entityInManagedObjectContext:self.managedObjectContext]; | |
// this is the main predicate to get the feed entries that belong to the us | |
NSPredicate *ownerPredicate = [NSPredicate predicateWithFormat:@"%K == %@ AND %K.%K == %@", | |
RNPFeedListEntryRelationships.owner, self, RNPFeedListEntryRelationships.feed, | |
RNPFeedAttributes.action, @(FeedAction_LIKE), self]; | |
// this is the predicate to check that we have the required item | |
NSPredicate *itemPopulatedPredicate = [NSPredicate predicateWithFormat:@"(%K.%K != nil AND %K.%K != nil) OR (%K.%K == nil)", | |
RNPFeedListEntryRelationships.feed, RNPFeedAttributes.itemId, | |
RNPFeedListEntryRelationships.feed, RNPFeedRelationships.item, | |
RNPFeedListEntryRelationships.feed, RNPFeedAttributes.itemId]; |
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
self.backgroundManagedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType]; | |
[self.backgroundManagedObjectContext setPersistentStoreCoordinator:persistentStoreCoordinator]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backgroundContextDidSave:) name:NSManagedObjectContextDidSaveNotification object:self.backgroundManagedObjectContext]; | |
- (void)backgroundContextDidSave:(NSNotification *)didSaveNotification { | |
[self.managedObjectContext performBlock:^{ | |
NSDate *start = [NSDate date]; | |
[self.managedObjectContext mergeChangesFromContextDidSaveNotification:didSaveNotification]; | |
DLog(@"Merging background changes took %f", [[NSDate date] timeIntervalSinceDate:start]); |
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)controllerWillChangeContent:(NSFetchedResultsController *)controller { | |
[self.tableView beginUpdates]; | |
} | |
- (void)controller:(NSFetchedResultsController*)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath*)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath*)newIndexPath | |
{ | |
UITableView* tableView = self.tableView; | |
switch (type) | |
{ | |
case NSFetchedResultsChangeInsert: |
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
// start nodule scanning for devices advertising these services | |
nodule.startScanning([['uuid1', 'uuid2'], ['uuid3', 'uuid4']]); | |
nodule.on('scan', function(devices) { | |
// devices is an array of devices that are advertising the requested services | |
/* | |
devices = [ | |
{ | |
deviceName: 'TI Sensor Tag', | |
advertisedServices: ['uuid1', 'uuid2'], |
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
<script src='https://code.jquery.com/jquery-2.1.3.min.js'></script> | |
<script src='https://www.nodule.io/js/nodule.151851370efa27253700.js'></script> |
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
nodule.connect('wss://app.nodule.io', '<API ACCESS TOKEN>').then(function(nodule) { | |
}, function(error) { | |
console.error('Connection failed', error); | |
} |
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
nodule.scanForPeripherals(<NAME REGEX>, [<SERVICE UUIDS>]); | |
// e.g. Scan for all peripherals with names ending in Temperature | |
nodule.scanForPeripherals(/.*Temperature/); | |
// e.g. Scan for all peripherals that advertise battery level and heart rate services | |
nodule.scanForPeripherals(/.*/, ['180F', '180D']); |
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
profile.services[SERVICE_UUID].characteristics[CHARACTERISTIC_UUID].writeUint8(1); | |
// you can use any of the following methods | |
writeUint8(number); | |
writeUint16(number); | |
writeUint32(number); | |
writeInt8(number); | |
writeInt16(number); | |
writeInt32(number); | |
writeText(string); |
OlderNewer