Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Kuchhadiya Akshay kuchhadiyaa

🏠
Working from home
Block or report user

Report or block kuchhadiyaa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danielphillips
danielphillips / UILabel+dynamicSizeMe.h
Created Jun 2, 2011
Adjust UILabel to change it's frame according to it's content
View UILabel+dynamicSizeMe.h
@interface UILabel (dynamicSizeMe)
-(float)resizeToFit;
-(float)expectedHeight;
@end
@TonnyXu
TonnyXu / NSOrderSet+Insert.md
Created Feb 1, 2012
NSOrderedSet does not work well on insert
View NSOrderSet+Insert.md

Usually, we generate an entity class with Editor->Create NSManagedOBject Subclass... For example we created a subclass of NSManagedObject

Xcode generates the .h file like this:

@interface MyEntity : NSManagedObject

@property (nonatomic, retain) NSOrderedSet manySubs;

//... some methods generated by Xcode
@Goles
Goles / CountryCodes.json
Created Jul 29, 2012
Country and Dial or Phone codes in JSON format
View CountryCodes.json
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@mattt
mattt / uiappearance-selector.md
Last active Nov 4, 2019
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3
View uiappearance-selector.md

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
  sed 's/UI_APPEARANCE_SELECTOR//g'   | \
@wwsean08
wwsean08 / ami_prune.py
Last active Aug 25, 2017
A lambda function that can be used to prune AMIs based on how old they are
View ami_prune.py
from __future__ import print_function
import os
import boto3
from datetime import datetime, timedelta
from dateutil.parser import parse
THRESHOLD = int(os.getenv('threshold_days', 30))
ENABLE_DELETE = os.getenv('enable_delete', False)
REGION = os.getenv('region', 'us-east-1')
@dionc
dionc / MapKitExtensions.swift
Last active Oct 1, 2018
Create an MKCoordinateRegion from an array of coordinates. Safely handles coordinates that cross the 180th meridian.
View MapKitExtensions.swift
import MapKit
extension MKCoordinateRegion {
init?(coordinates: [CLLocationCoordinate2D]) {
// first create a region centered around the prime meridian
let primeRegion = MKCoordinateRegion.region(for: coordinates, transform: { $0 }, inverseTransform: { $0 })
// next create a region centered around the 180th meridian
You can’t perform that action at this time.