This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)myInitialization | |
{ | |
//do your stuff | |
} | |
- (id)initWithFrame:(CGRect)aRect | |
{ | |
self = [super initWithFrame:aRect]; | |
if (self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PortionProgress.swift | |
// PortionProgress | |
// | |
// Created by Erison Veshi on 7/24/16. | |
// Copyright © 2016 Bashta. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSDate { | |
func startOfDay(calendar: NSCalendar) -> NSDate { | |
return calendar.startOfDayForDate(self) | |
} | |
func endOfDay(calendar: NSCalendar) -> NSDate? { | |
let components = NSDateComponents() | |
components.day = 1 | |
components.second = -1 | |
return calendar.dateByAddingComponents(components, toDate: startOfDay(calendar), options: NSCalendarOptions()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static func showCameraRollFrom<T: UIViewController where T: protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>>(viewController: T) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SystemConfiguration | |
public class Reachability { | |
class func isConnectedToNetwork() -> Bool { | |
var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) | |
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress)) | |
zeroAddress.sin_family = sa_family_t(AF_INET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func dealCards() { | |
for _ in deck.cards { | |
for player in players { | |
player.addCard(card: deck.drawCard()) | |
if deck.cards.count == 0 { | |
return | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UserRouter.swift | |
// GithubSearch | |
// | |
// Created by Er on 12/16/16. | |
// | |
import Alamofire | |
enum Router: URLRequestConvertible { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let size = chacheDictionary.keys.reduce(0) { (result, key) -> Int in | |
return result + malloc_size(Unmanaged.passRetained(key as AnyObject).toOpaque()) + malloc_size(Unmanaged.passRetained(chacheDictionary[key] as AnyObject).toOpaque()) | |
} | |
print(size) | |
//500bytes per obj in median. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SnappCameraView.swift | |
// EdgeDetection | |
// | |
// Created by er on 11/4/17. | |
// Copyright (c) 2017 Erison Veshi | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |