Skip to content

Instantly share code, notes, and snippets.

View Bashta's full-sized avatar
🎯
Focusing

Erison Veshi Bashta

🎯
Focusing
  • Vlore
View GitHub Profile
- (void)myInitialization
{
//do your stuff
}
- (id)initWithFrame:(CGRect)aRect
{
self = [super initWithFrame:aRect];
if (self)
//
// PortionProgress.swift
// PortionProgress
//
// Created by Erison Veshi on 7/24/16.
// Copyright © 2016 Bashta. All rights reserved.
//
import UIKit
@Bashta
Bashta / 0_reuse_code.js
Created July 25, 2016 15:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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())
static func showCameraRollFrom<T: UIViewController where T: protocol<UIImagePickerControllerDelegate, UINavigationControllerDelegate>>(viewController: T) {
}
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)
func dealCards() {
for _ in deck.cards {
for player in players {
player.addCard(card: deck.drawCard())
if deck.cards.count == 0 {
return
}
}
}
}
//
// UserRouter.swift
// GithubSearch
//
// Created by Er on 12/16/16.
//
import Alamofire
enum Router: URLRequestConvertible {
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.
@Bashta
Bashta / SnappCameraView.swift
Last active June 28, 2019 15:08
Basic implementation of camera scanner for rectangles.
//
// 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