Skip to content

Instantly share code, notes, and snippets.

View jurezove's full-sized avatar

Jure Žove jurezove

  • ConvertKit
  • Europe
View GitHub Profile
@jurezove
jurezove / iOS Layout Anchors.swift
Last active April 6, 2017 17:15
Demonstrating Layout Anchors on iOS
//: 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 March 30, 2016 18:09
Explaining Intrinsic Content Size
//
// 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()
// 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)")
}
@jurezove
jurezove / zendesk.swift
Last active February 3, 2016 09:15
Zendesk init
// 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) {
//: 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 / Macros.h
Created October 17, 2012 11:26 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
#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
@jurezove
jurezove / main.rb
Last active August 29, 2015 14:07
Object Oriented relationship using Test Driven approach.
# Engine stuff
class Engine;end
class MotorcycleEngine < Engine
def start
"Wroom!"
end
end