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 *string = [NSString alloc] initWithStringFormat:@"%i", 3]; |
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
#import <Foundation/Foundation.h> | |
/* Test I had to do, Took me way to long so thought I would draft it up in objective c | |
basically getting the remainder using the % modular type. | |
loop through to 100, if number is divisible by 3 print buzz if its divisible by 5 print fizz and if its both print buzz fizz. Else just print the number. | |
*/ | |
int main(int argc, char *argv[]) { |
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
console.log("hello CRC16"); | |
function CreateCrc16(){ | |
var polynomial,value,temp; | |
var table=new Array(256); | |
polynomial=40961; | |
for(i=0;i<table.length;++i){ | |
value=0;temp=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
#pragma mark - Table View Data Source | |
- (NSInteger)tableView:(UITableView *)tableView | |
numberOfRowsInSection:(NSInteger)section | |
{ | |
return 0; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView | |
cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ |
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
// Create the path (with only the top-left corner rounded) | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_categoryColorView.bounds | |
byRoundingCorners:UIRectCornerTopLeft | | |
UIRectCornerBottomLeft | |
cornerRadii:CGSizeMake(10.0, 10.0)]; | |
// Create the shape layer and set its path | |
CAShapeLayer *maskLayerTop = [CAShapeLayer layer]; | |
maskLayerTop.frame = _categoryColorView.bounds; |
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
#pragma mark - Table view data source | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
return 1; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return 0; | |
} |
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
//-- NOTE: Do not forget to add Framework | |
//-- Extra Header Code | |
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; | |
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; | |
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; | |
- (void)saveContext; |
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 performSegueWithIdentifier:@"id" sender:self]; | |
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ | |
if ([segue.identifier isEqualToString:@"id"]) { | |
// Do stuff. | |
} | |
} |
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
/* Can be called from any thread */ | |
- (void)managedObjectContextDidSave:(NSNotification *)note | |
{ | |
// FIX: you must mergeChangesFromContextDidSaveNotification: on main thread | |
// handling the notification occurs on background thread. | |
// it needs to "merge" on the main thread. | |
// From: http://benford.me/blog/2012/5/7/an-observer-of-nsmanagedobjectcontextdidsavenotification-html | |
NSManagedObjectContext *context = (NSManagedObjectContext *)note.object; | |
if( context.persistentStoreCoordinator == managedObjectContext.persistentStoreCoordinator ){ |
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
for i in 1...100{ | |
let divisbleBy3 = i%3 | |
let divisbleBy5 = i%5 | |
if divisbleBy3 == 0 && divisbleBy5 == 0{ // no remainder | |
println("fizz buzz") | |
}else if divisbleBy3 == 0{ | |
println("fizz") | |
}else if divisbleBy5 == 0{ | |
println("buzz") |
OlderNewer