Skip to content

Instantly share code, notes, and snippets.

View tmdvs's full-sized avatar
🔆
making cool stuff with cool people

Tim Davies tmdvs

🔆
making cool stuff with cool people
View GitHub Profile
nav#socialicons img { margin-right: 16px; opacity: 0.35; -webkit-transition-duration: 0.5s;}
nav#socialicons span { display: block; padding: 0px 10px; position: absolute; top: -28px; opacity: 0; border-radius: 50px; background: #222; -webkit-transition-duration: 0.5s;}
nav#socialicons a:hover img { opacity: 1; -webkit-transform: rotateY(360deg); -webkit-transition-timing-function: ease-out; }
nav#socialicons a:hover img + span { opacity: 1;}
typedef enum {
SyncManagerStatusOK,
SyncManagerStatusFailed,
SyncManagerStatusPending,
SyncManagerStatusDownloading,
SyncManagerStatusWriting,
SyncManagerStatusDownloadingTemplates,
SyncManagerStatusWritingTemplates,
SyncManagerStatusDownloadingDocuments,
SyncManagerStatusWritingDocuments,
typedef enum {
SyncManagerStatusOK,
SyncManagerStatusFailed,
SyncManagerStatusPending,
SyncManagerStatusDownloading,
SyncManagerStatusWriting,
SyncManagerStatusDownloadingTemplates,
SyncManagerStatusWritingTemplates,
SyncManagerStatusDownloadingDocuments,
SyncManagerStatusWritingDocuments,
NSArray *myMainThreadShit = nil;
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
// do massive intensive shit
NSArray *myShit = [MyModel getMyShit];
dispatch_async( dispatch_get_main_queue(), ^{
// this is on main thread
myMainThreadShit = [myShit copy];
#pragma mark -
#pragma mark Core Data stack
/**
Returns the managed object context for the application.
If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
*/
- (NSManagedObjectContext *) managedObjectContext {
if (managedObjectContext != nil) {
#import "NSDataAdditions.h"
static char encodingTable[64] = {
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' };
@implementation NSData (NSDataAdditions)
+ (NSData *) dataWithBase64EncodedString:(NSString *) string {
@implementation StubbyNavigationController
- (UINavigationBar *)navigationBar
{
[super.navigationBar setFrame:CGRectMake(0, 20, 300, 44)];
return super.navigationBar;
}
@end
What Apple gives you and will cause a crash as dequeueReusableCellWithIdentifier: can't return a cell as none have ever been initialised.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;
}
// Get the data into a bitmap.
[self lockFocus];
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[self bounds]];
[self unlockFocus];
// Make an NSImage from our bitmap.
image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
[image addRepresentation:rep];
NSData * tiffData = [image TIFFRepresentationUsingCompression: NSTIFFCompressionNone factor: 0.0f];

This is a gist.io test

This is a subheading

This is some simple body text that I am writing. why not click here