Skip to content

Instantly share code, notes, and snippets.

View irshadpc's full-sized avatar
🎯
Focusing

IRSHAD PC irshadpc

🎯
Focusing
  • Hatio Innovations Private Limited
  • Kochi, India
  • X @_irshadpc
View GitHub Profile
- (UIImage *)compressImage:(UIImage *)image{
float actualHeight = image.size.height;
float actualWidth = image.size.width;
float maxHeight = 600.0;
float maxWidth = 800.0;
float imgRatio = actualWidth/actualHeight;
float maxRatio = maxWidth/maxHeight;
float compressionQuality = 0.5;//50 percent compression
if (actualHeight > maxHeight || actualWidth > maxWidth) {
//
// UIImage+ImageSplitting.h
// Test
//
// Created by Robert Saunders on 03/02/2012.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
// NSString_stripHtml.h
// Copyright 2011 Leigh McCulloch. Released under the MIT license.
#import <Foundation/Foundation.h>
@interface NSString (stripHtml)
- (NSString*)stripHtml;
@end
@irshadpc
irshadpc / book.m
Created June 6, 2014 18:30 — forked from mdippery/book.m
#import <Foundation/Foundation.h>
@interface Book : NSObject
{
NSMutableDictionary *data;
}
@property (retain) NSString *title;
@property (retain) NSString *author;
@end
//
// ViewController.swift
// TestSwift
//
// Created by Jameson Quave on 6/2/14.
// Copyright (c) 2014 JQ Software LLC. All rights reserved.
//
import UIKit

Natasha Murashev - Protocol oriented MVVM

  • Amazing talks by Andy Matushak (Controlling complexity in Swift & Making friends with value types) made her dive into value types more. Every time she made a value type she needed to subclass and she turned out using a class anyway. Then the talk about POP at WWDC 2015 happened. “Swift is protocol-oriented programming language” -Dave Abrahams.
  • The power of protocols is know to most because of stuff like UITableViewDataSource, UITableViewDelegate and more. These patterns are beautiful and we all love them. But at work it’s hard to suddenly transition to a new paradigm.
  • Reading: MVVM in Swift. MVVM is all about abstracting model, formatting and other data related things out of your ViewController. View models are very testable and clean. The view controller should keep track of the view model state. When view models are static the view controller will determine what is displayed to the user, the view m
@irshadpc
irshadpc / gist:9fd7ea67a0a0de8bbb13
Created February 16, 2016 05:36
Coredata data fetch between two dates
+ (NSArray*)allEntriesInContext:(NSManagedObjectContext*)context fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate{
// Create the request
NSFetchRequest *request = [[NSFetchRequest alloc]initWithEntityName:@"Entry"];
// Build the predicate
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"date >= %@ && date <= %@ ", fromDate, toDate];
request.predicate = predicate;
// Define sorting
NSSortDescriptor *sortDesc = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES];
request.sortDescriptors = @[sortDesc];
@irshadpc
irshadpc / introrx.md
Created March 15, 2016 09:05 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@irshadpc
irshadpc / .gitignore
Created June 9, 2016 08:14 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@irshadpc
irshadpc / gist:e729b494c85c1322499d5e54912ad8b9
Created September 28, 2016 06:13 — forked from steipete/ios-xcode-device-support.sh
Using iOS 10.1 devices with Xcode 8.0 (or: Xcode 7.3.1 and iOS 10 devices, same trick)
// The trick is to link the DeviceSupport folder from the beta to the stable version.
ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.1\ \(14B54\)/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
// Then restart Xcode and recommect your devices. You will need to do that for every beta of iOS 10.1+/Xcode 8.
// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)