Skip to content

Instantly share code, notes, and snippets.

tell application "Notes"
set theNotes to every note of the folder "Notes"
repeat with thisNote in theNotes
set myTitle to the name of thisNote
set myText to the body of thisNote
set myCreateDate to the creation date of thisNote
tell application "Evernote"
create note with html myText ¬
title myTitle ¬
created myCreateDate ¬
- (UIImage *)createCroppedImageFromImage:(UIImage *)image {
float scale = 1.0f/self.scrollView.zoomScale;
CGRect visibleRect;
visibleRect.origin.x = self.scrollView.contentOffset.x * scale;
visibleRect.origin.y = self.scrollView.contentOffset.y * scale;
visibleRect.size.width = self.scrollView.bounds.size.width * scale;
visibleRect.size.height = self.scrollView.bounds.size.height * scale;
@Rich86man
Rich86man / gist:5680906
Created May 30, 2013 20:27
persistantStoreCoordinator
// Returns the persistent store coordinator for the application.
// If the coordinator doesn't already exist, it is created and the application's store added to it.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (!_persistentStoreCoordinator) {
NSURL *storeURL = [[[NSFileManager defaultManager] applicationDocumentsDirectory] URLByAppendingPathComponent:@"UfoSightings.sqlite"];
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
@Rich86man
Rich86man / gist:5500278
Created May 2, 2013 05:17
This seems to work too
- (void)loadGroup:(NSString *)group {
// If the groups the same, no need to reload.
if ([_currentGroup isEqualToString:group]) {
return;
}
_currentGroup = group;
NSLog(@"%@: %@", _currentGroup, [_appearanceContainer[_currentGroup] backgroundColor]);
[UIView animateWithDuration:kAnimationDuration animations:^{
_sharedInstance.frame = CGRectMake(0, _parentView.frame.size.height, _parentView.frame.size.width, kAppBarTotalHeight);
@Rich86man
Rich86man / gist:5500134
Created May 2, 2013 04:22
draw rect doesn't like bgColor
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
if (_currentGroup == nil) {
CGContextSetFillColorWithColor(context, kDefaultAccentColor.CGColor);
CGContextSetStrokeColorWithColor(context, kDefaultAccentColor.CGColor);
} else {
CGContextSetFillColorWithColor(context, [_appearanceContainer[_currentGroup] backgroundColor].CGColor);
CGContextFillRect(context, self.bounds);
- (id)initWithFrame:(CGRect)frame
{
self = [[[NSBundle mainBundle] loadNibNamed:@"MYTableViewCell" owner:self options:nil] objectAtIndex:0];
if(self) {
}
return self;
}
#import <UIKit/UIKit.h>
@interface UIImage(Extras)
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize;
+ (UIImage*)strechyWhiteButton;
+ (UIImage*)strechyWhiteButtonPressed;
- (AVCaptureSession*)captureSession
{
if(!_captureSession) {
_captureSession = [[AVCaptureSession alloc] init];
_captureSession.sessionPreset = AVCaptureSessionPresetMedium;
AVCaptureDeviceInput* videoInput = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice frontFacingCameraIfAvailable] error:nil];
AVCaptureDeviceInput * audioInput = [AVCaptureDeviceInput deviceInputWithDevice:[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio] error:nil];
self.readingResource = [[ZOReadingResource alloc]initWithKidId:nil delegate:nil finished:nil failed:nil];
==
self.readingResource = [[ZOReadingResource alloc]init];
[myReadingResource createBook:aBook
kids:@[kid1,kid2]
success:^(NSManagedObjectID* objId){
//Blah blah use ObjID to fetch reading
} failed:^{}];