Skip to content

Instantly share code, notes, and snippets.

Avatar

Jure Žove jurezove

  • ConvertKit
  • Europe
View GitHub Profile
@jurezove
jurezove / iOS Layout Anchors.swift
Last active Apr 6, 2017
Demonstrating Layout Anchors on iOS
View iOS Layout Anchors.swift
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
XCPlaygroundPage.currentPage.needsIndefiniteExecution = true
var container = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
container.backgroundColor = UIColor.greenColor()
XCPlaygroundPage.currentPage.liveView = container
@jurezove
jurezove / IntrinsicContentSize.swift
Last active Mar 30, 2016
Explaining Intrinsic Content Size
View IntrinsicContentSize.swift
//
// How can intrinsic content size help make my layouts cleaner?
// More on http://candycode.io/how-can-intrinsic-content-size-help-make-my-layouts-cleaner/
import UIKit
import XCPlayground
var view = UIView(frame: CGRect(x: 0, y: 0, width: 600, height: 600))
view.backgroundColor = .whiteColor()
View zendesk2.swift
// Code:
ZDKLogger.enable(true)
ZDKConfig.instance().initializeWithAppId(OTConstants.Services.ZendeskAppID, zendeskUrl: OTConstants.Services.ZendeskURL, clientId: OTConstants.Services.ZendeskClientID, onSuccess: { () -> Void in
if let user = OTKApplication.session.currentUser {
Zendesk.identifyUser(user)
ZDKHelpCenter.showHelpCenterWithNavController(self.navigationController)
}
}) { (error: NSError!) -> Void in
debugPrint("Error initializing ZenDesk: \(error)")
}
View zendesk.swift
// Init in application:didFinishLaunchingWithOptions
ZDKConfig.instance().initializeWithAppId(OTConstants.Services.ZendeskAppID, zendeskUrl: OTConstants.Services.ZendeskURL, clientId: OTConstants.Services.ZendeskClientID, onSuccess: { () -> Void in
}) { (error: NSError!) -> Void in
debugPrint("Error initializing ZenDesk: \(error)")
}
// Identifying or re-identifying the user
class func identifyUser(user: OTKUser) {
View json-parsing.swift
//: Playground - noun: a place where people can play
import UIKit
import Foundation
extension NSString {
private static let unicodeTransform: NSString = "Any-Hex/Java"
func decodeUnicode() -> NSString? {
@jurezove
jurezove / main.rb
Last active Aug 29, 2015
Object Oriented relationship using Test Driven approach.
View main.rb
# Engine stuff
class Engine;end
class MotorcycleEngine < Engine
def start
"Wroom!"
end
end
@jurezove
jurezove / Macros.h
Created Oct 17, 2012 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
View Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
You can’t perform that action at this time.