This file contains hidden or 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
<!--Allow unsecured connections in a whitelist--> | |
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>yourserver.com</key> | |
<dict> | |
<!--Include to allow subdomains--> | |
<key>NSIncludesSubdomains</key> | |
<true/> |
This file contains hidden or 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
// To check if a number is between a range, don't do | |
if number >=0 && number <= 100 { | |
} | |
// Use range and news operators instead : | |
if 0...100 ~= number { | |
} |
This file contains hidden or 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 UIView { | |
//MARK: - AutoScroll Stuff - | |
private func autoScroll(view: UIView, kbFrame: CGRect, animated: Bool) { | |
let offset = kbFrame.height + 20 | |
let deltaOffset = CGRectGetMinY(view.convertRect(view.bounds, toView: self.view)) - offset | |
autoScrollOffset = deltaOffset < 0 ? 0 : deltaOffset | |
totalAutoScrollOffset = autoScrollOffset |
This file contains hidden or 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 SpringView { | |
func fadeIn(duration: CGFloat, completion: (() -> ())? = nil) { | |
self.animation = "fadeIn" | |
self.duration = duration | |
self.animateNext() { | |
completion?() | |
} | |
} |
This file contains hidden or 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
// Create CustomView.xib, set File's Owner to CustomView. | |
// Link the top level view in the XIB to the contentView outlet. | |
class CustomView : UIView { | |
@IBOutlet weak private var contentView:UIView! | |
// other outlets | |
override init(frame: CGRect) { // for using CustomView in code | |
super.init(frame: frame) | |
self.commonInit() |
This file contains hidden or 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
// | |
// UIViewExtension.swift | |
// SwiftTester | |
// | |
// Created by JulienGdt on 07/07/15. | |
// Copyright (c) 2015 JulienGdt @jlngdt. All rights reserved. | |
// @see https://gist.github.com/juliengdt/a80deda0ed2240b4d347 | |
// | |
import UIKit |
This file contains hidden or 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
#CODE COMPLEXITY | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 wc -l | awk '$1 > 400 && $2 != "total" {for(i=2;i<NF;i++){printf "%s%s", $i, " "} print $NF ":1: warning: File more than 400 lines (" $1 "), consider refactoring." }' | |
#TODO & FIXME CHECKER | |
KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/" | |
#TOTAL LINES - USELESS BUT FUN | |
echo "Total lines of code:" | |
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 cat | wc -l |
This file contains hidden or 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
# Created by https://www.gitignore.io/api/carthage,objective-c,swift,xcode,osx | |
### Carthage ### | |
# Carthage - A simple, decentralized dependency manager for Cocoa | |
Carthage.checkout | |
Carthage.build | |
### Objective-C ### | |
# Xcode |
This file contains hidden or 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 UIApplication { | |
class func appVersion() -> String { | |
return NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String | |
} | |
class func appBuild() -> String { | |
return NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleVersionKey as String) as! String | |
} |
This file contains hidden or 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
#!/bin/sh | |
# author: julien gdt | |
# regex='^[\[](ADD|IMP|FIX)[\]]' | |
# regexjira='^[\[]JIRA[\]][[:space:]][\#][0-9]' | |
# regexversion='^Version[[:space:]][0-9]\.[0-9]\.[0-9][[space:]][a-zA-Z]{3,}' | |
var=`head -n 1 "$1"` | |
function info |