Skip to content

Instantly share code, notes, and snippets.

View shabib87's full-sized avatar

Shabib Hossain shabib87

View GitHub Profile
@shabib87
shabib87 / UIFont+DahDit
Last active August 1, 2016 06:09 — forked from erkie/UIFont+DahDit
UILabel get CGRect for substring of text
//
// UIFont+DahDit.m
// DahDit
//
// Created by Erik Andersson on 2011-07-28.
// Copyright 2011 Åva gymnasium. All rights reserved.
//
#import "UIFont+DahDit.h"
@shabib87
shabib87 / TextViewWithPlaceholderAndExpandingHeight.swift
Last active March 5, 2017 06:11
An UITextFiled like UITextView subclass with placeholder and round border and it updates it's height on text change. The default color for border and placeholder text color are similar with UITextFields.
/*
TextViewWithPlaceholderAndExpandingHeight.swift
TextViewWithPlaceholderAndExpandingHeight
Created by Shabib Hossain on 1/24/17.
Copyright (c) 2017 shabib87 <shabib.sust@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
class SmartCar {
func driveOnRoad() {
print("Vroom!")
}
func talk() {
print("Hi! I am the smart talking car!")
}
}
protocol Flyable {
func flyOnAir()
}
class SmartFlyingCar: SmartCar, Flyable {
func flyOnAir() {
print("Wohoo! I am flying high!")
}
}
class SuperSmartCar: SmartCar {
func driveOnWater() {
print("I can run over water, because I can! B-)")
}
}
protocol RoadDrivable {
func driveOnRoad()
}
protocol WaterDrivable {
func driveOnWater()
}
protocol Flyable {
func flyOnAir()
class SmartBoat: SmartVehicle, RoadDrivable, WaterDrivable {
func driveOnRoad() {
print("Vroom!")
}
func driveOnWater() {
print("I can run over water, because I can! B-)")
}
}
@implementation Singleton
+ (instancetype)sharedInstance {
static Singleton *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[Singleton alloc] init];
});
return sharedInstance;
class Singleton {
static let sharedInstance = Singleton()
private init() {
// do stuff
}
}
class User {
var name = ""
var age = 0
}
class EditUserInfoController {
var user: User
init (user: User) {
self.user = user