Skip to content

Instantly share code, notes, and snippets.

View Bashta's full-sized avatar
🎯
Focusing

Erison Veshi Bashta

🎯
Focusing
  • Vlore
View GitHub Profile
struct Array2D<T> {
let columns: Int
let rows: Int
private var array: Array<T?>
init(columns: Int, rows: Int) {
self.columns = columns
self.rows = rows
@Bashta
Bashta / GameScene
Last active August 29, 2015 14:10
GameScene
import SpriteKit
protocol GameSceneDelegate {
func gameOver()
}
class GameScene: SKScene {
var gameSceneDelegate: GameSceneDelegate?
var health: Int = 10
@Bashta
Bashta / Menuscene
Last active August 29, 2015 14:10
MenuScene
import SpriteKit
class MenuScene: SKScene {
var label = SKLabelNode(fontNamed: "Chalkduster")
override func didMoveToView(view: SKView) {
label.text = "The Game is finished! This is the menu"
label.fontSize = 20
@Bashta
Bashta / GameViewController
Created December 2, 2014 21:03
GameViewController
import SpriteKit
class GameViewController: UIViewController, GameSceneDelegate {
@IBOutlet weak var skView: SKView!
override func viewDidLoad() {
super.viewDidLoad()
let scene = GameScene(size: skView.bounds.size)
import Darwin
/**
Representation of a connected socket or error.
Either a Descriptor with an associated value for the POSIX
socket file descriptor or an Error with a string describing
the error.
*/
enum Connection {
case Descriptor(CInt)
// See the accompanying blog post: http://chris.eidhof.nl/posts/tiny-networking-in-swift.html
public enum Method: String { // Bluntly stolen from Alamofire
case OPTIONS = "OPTIONS"
case GET = "GET"
case HEAD = "HEAD"
case POST = "POST"
case PUT = "PUT"
case PATCH = "PATCH"
case DELETE = "DELETE"
func setupCellForCheckins() {
let venueName: String = utils.getParamFromDictionary(cellData, searchKey: "check_in_title", defaultStr: "No data")
titleLabel?.text = venueName
let usersCheckedIn: String = utils.getParamFromDictionary(cellData, searchKey: "check_in_location_appended_data_collection", defaultStr: "No data")
messageSenderLabel?.text = usersCheckedIn
let timeAgo: String = utils.getParamFromDictionary(cellData, searchKey: "user_creation_date_ago", defaultStr: "No data")
messageTimeLabel?.text = timeAgo
func setupCellForPublic() {
let name: String = utils.getParamFromDictionary(cellData, searchKey: "message_author_name", defaultStr: "?")
titleLabel?.text = name
let currentVenue = utils.getParamFromDictionary(cellData, searchKey: "message_current_venue", defaultStr: "?")
messageSenderLabel?.text = currentVenue
let timeAgo = utils.getParamFromDictionary(cellData, searchKey: "message_last_message_time", defaultStr: "?")
private extension NewMessageViewController {
func checkLocationPermisions() {
let status = CLLocationManager.authorizationStatus()
switch status {
case .NotDetermined:
dataMgr.locationManager.requestWhenInUseAuthorization()
break
case .AuthorizedWhenInUse:
PFObject *tempBill = [PFObject objectWithClassName:@"Bill"];
tempBill[@"amount"] = @0;
tempBill[@"category"] = @"";
tempBill[@"comment"] = pfBill[@"comment"];
tempBill[@"date"] = pfBill[@"date"];
tempBill[@"parentCategory"] = pfBill[@"parentCategory"];
tempBill[@"type"] = pfBill[@"type"];
[weakSelf saveBill:tempBill pfObjectWithRelations:pfObjectWithRelations completionBlock:^{
__weak __typeof(self) weakSelf = self;
[weakSelf saveBill:pfBill pfObjectWithRelations:tempBill completionBlock:nil];