Skip to content

Instantly share code, notes, and snippets.

Amit Jain gravicle

View GitHub Profile
View StringPermutations.m
#import <Foundation/Foundation.h>
/*
CONSTRAINTS:
1. Case insensitive
2. Unicode? no
3. Moderatetly long strings?
4. Empty strings are palindromes of each other
5. Same strings? true
View ThrowingOptionalUnwrap.swift
struct Person {
let firstName: String
let lastName: String
let ethnicity: String?
}
// Using throwable optional unwrapping
extension Person {
init(firstName: String?, lastName: String?, ethnicity: String?) throws {
@gravicle
gravicle / README.md
Created Jun 16, 2017 — forked from hofmannsven/README.md
My simply Git Cheatsheet
View HTTPError.swift
public enum HTTPError: Error, ExpressibleByIntegerLiteral {
case badRequest(description: String?)
case unauthorized(description: String?)
case notFound(description: String?)
case serverError(description: String?)
case unprocessableRequest(description: String?)
case unknown(description: String?)
}
View StatusDot.swift
import UIKit
@IBDesignable
final class StatusDot: UIView {
convenience init() {
self.init(frame: .zero)
}
override init(frame: CGRect) {
View InjectionFailure.txt
Disconnected from: /Users/gravicle/Library/Developer/CoreSimulator/Devices/67CA6865-8F5A-4040-A0C6-AAF32CC78554/data/Containers/Bundle/Application/14109655-F7D3-4F03-87DD-72B3E11A15AE/CircleMedicalPatient.app/CircleMedicalPatientConnection from: /Users/gravicle/Library/Developer/CoreSimulator/Devices/67CA6865-8F5A-4040-A0C6-AAF32CC78554/data/Containers/Bundle/Application/FF82A656-557B-4F86-8583-9BF4CE74A9AC/CircleMedicalPatient.app/CircleMedicalPatient x86_64 (22)buidRoot: /Users/gravicle/Library/Developer/Xcode/DerivedData/CircleMedicalPatient-gazepgpdyvnfsthbejusiexjjjth/BuildlogDir: /Users/gravicle/Library/Developer/Xcode/DerivedData/CircleMedicalPatient-gazepgpdyvnfsthbejusiexjjjth/Logs/BuildCopying iOSBundleTemplate into project.Migrating project parameters to bundle..Inported setting IPHONEOS_DEPLOYMENT_TARGET = 9.3;Inported setting SDKROOT = iphoneos;Inported setting CLANG_ENABLE_OBJC_ARC = YES;Inported setting CLANG_CXX_LANGUAGE_STANDARD = “gnu++0x”;Inported setting CLANG_CXX_LIBRARY = “libc++”;2017-0
@gravicle
gravicle / RunScript.sh
Last active Jan 4, 2017 — forked from pala/RunScript
Show TODO's And FIXME's As Warnings
View RunScript.sh
TAGS="FIXME:|TODO:"
ERRORTAG="ERROR:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$|($ERRORTAG).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" | perl -p -e "s/($ERRORTAG)/ error: \$1/"
@gravicle
gravicle / IBLoadableView.swift
Last active Oct 17, 2016
Abstract class allowing UIViews to be programmatically initialized while using IB internally for layout
View IBLoadableView.swift
import UIKit
/// Allows loading view from Nibs named the same as the class.
class IBLoadableView: UIView {
fileprivate var view: UIView!
convenience init() {
self.init(frame: CGRect.zero)
}
View Swift3AccessLevels.md
Scope Access Access Level
across modules import public
           | subclass | open

within module | import | internal final | subclass | internal within file | use | fileprivate final | subclass | fileprivate within scope | use | private final | subclass | private

View AppointmentConflicts.txt
We have a few appointments coming up. Can you determine if there are conflicts, and if there are, can you print them out?
2:30 PM → 4:0 PM
11:00 AM → 11:20 AM
12:00 PM → 1:30 PM
9:45 AM → 10:45 AM
12:30 PM → 2:15 PM
4:00 PM → 5:30 PM
9:00 AM → 10:30 AM
4:45 PM → 6:00 PM
You can’t perform that action at this time.