- In general you want to try and put things in
onStartandonStopfor logical start and stops.
- Dagger inject self into graph
- setContentView(R.layout.xxx)
- Butterknife.bind(this)
- RxJava CompositeSubscription.add (if NON UI related work being done)
| func makeGetCall() { | |
| // Set up the URL request | |
| let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1" | |
| guard let url = URL(string: todoEndpoint) else { | |
| print("Error: cannot create URL") | |
| return | |
| } | |
| let urlRequest = URLRequest(url: url) | |
| // set up the session |
#Intro
Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
| #!/bin/sh | |
| # License for any modification to the original (linked below): | |
| # ---------------------------------------------------------------------------- | |
| # "THE BEER-WARE LICENSE" (Revision 42): | |
| # Sebastiano Poggi wrote this file. As long as you retain | |
| # this notice you can do whatever you want with this stuff. If we meet some day, | |
| # and you think this stuff is worth it, you can buy us a beer in return. | |
| # | |
| # Based on http://bit.ly/295BHLx |
| firstLine=`head -2 $1 | tail -1` | |
| if [[ $firstLine == \#* ]]; then # Testing that the file starts with a comment, not yet a real commit ;) | |
| echo '<type>(<component>): <subject>' > .prepare-commit-msg-temp | |
| echo '' >> .prepare-commit-msg-temp | |
| echo '<body>' >> .prepare-commit-msg-temp | |
| echo '' >> .prepare-commit-msg-temp | |
| echo '# types: feat, fix, docs, style, refactor, test, chore(mantean)' >> .prepare-commit-msg-temp | |
| { cat .prepare-commit-msg-temp; cat $1; } > .prepare-commit-msg-temp2 | |
| cat .prepare-commit-msg-temp2 > $1 |
These rules are adopted from the AngularJS commit conventions.
#####Logcat Colors for IntelliJ Darcula Theme (original post)
Debug : #6897BB
Info : #6A8759
| /* | |
| * Copyright (C) 2016 Jeff Gilfelt. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| 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 | |
| } |