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
#!/bin/sh
# build.sh
#
# Created by IRSHAD PC on 10/02/17.
# Copyright © 2017 IRSHAD PC. All rights reserved.
PROJDIR=${WORKSPACE}/___PROJECT NAME___
PROJECT_NAME=___XCODE PROJECT NAME___
TARGET_SDK="iphonesimulator4.0"
@irshadpc
irshadpc / CalculatorView.swift
Created February 28, 2017 11:45 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop
case CenterTop
case RightTop
@irshadpc
irshadpc / gist:4c3b1677996a024eb23ee0bc85667536
Created February 23, 2017 06:17
Stripping Unwanted Architectures From Dynamic Libraries In Xcode
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
@irshadpc
irshadpc / UIImagePickerController+cats.m
Created November 3, 2016 07:13 — forked from iandundas/UIImagePickerController+cats.m
How to detect iOS Photo library or Camera permissions (>iOS8)
//
// Created by Ian Dundas on 16/03/15.
//
#import "UIImagePickerController+cats.h"
#import <AVFoundation/AVFoundation.h>
#import "Photos/Photos.h"
/*
example usage:
@irshadpc
irshadpc / gist:f43e7cb2010fe5f4a7c84fd89bb57da4
Created October 22, 2016 15:42 — forked from adamgit/gist:3705459
Automatically create cross-platform (simulator + device) static libraries for Objective C / iPhone / iPad
##########################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.82
#
# Latest Change:
# - MORE tweaks to get the iOS 10+ and 9- working
# - Support iOS 10+
# - Corrected typo for iOS 1-10+ (thanks @stuikomma)
@irshadpc
irshadpc / iOSMapKitFitAnnotations.m
Last active October 16, 2016 14:39 — forked from andrewgleave/iOSMapKitFitAnnotations.m
Zooms out a MKMapView to enclose all its annotations (inc. current location)
MKMapRect zoomRect = MKMapRectNull;
for (id <MKAnnotation> annotation in mapView.annotations) {
MKMapPoint annotationPoint = MKMapPointForCoordinate(annotation.coordinate);
MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0);
if (MKMapRectIsNull(zoomRect)) {
zoomRect = pointRect;
} else {
zoomRect = MKMapRectUnion(zoomRect, pointRect);
}
}
@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 :)
@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 / introrx.md
Created March 15, 2016 09:05 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@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];