It means to use Markdown formatting and Markdown files to enhance your projects, more precisely the management around it.
Markdown synthax is essentially used for formatting raw text into a bit more sexy one (This file is MD formatted !).
Hooks are plugins which can be launch by git, on a special event.
The commit-msg
hook, if defined, is launched when user want commit
It's a git-enforced policy, used in entreprise to force dev to correctly format their commit messages
Here is a custom commit-msg
hook which looks for a format like these both:
#!/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 |
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 | |
} |
#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 |
// | |
// 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 |
// 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() |
extension SpringView { | |
func fadeIn(duration: CGFloat, completion: (() -> ())? = nil) { | |
self.animation = "fadeIn" | |
self.duration = duration | |
self.animateNext() { | |
completion?() | |
} | |
} |
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 |
<!--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/> |