This file contains 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
// See also: http://stackoverflow.com/questions/22490057/android-okhttp-with-basic-authentication | |
// Uses authenticator | |
fun login(val id: String, val password: String) { | |
var client = OkHttpClient() | |
client.authenticator = object:Authenticator() { | |
@Throws(IOException::class) | |
fun authenticate(route: Route, response: Response): Request { | |
var credential = Credentials.basic(id, password) | |
var request = response.request | |
.newBuilder() |
This file contains 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
class CreditCardNumberFormattingTextWatcher : TextWatcher { | |
private var current = "" | |
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { | |
} | |
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { | |
} | |
override fun afterTextChanged(s: Editable) { |
This file contains 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
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
callbackManager.onActivityResult(requestCode, resultCode, data); | |
GraphRequest request = GraphRequest.newMeRequest( | |
accessToken, | |
new GraphRequest.GraphJSONObjectCallback() { | |
@Override | |
public void onCompleted( |
This file contains 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
package eu.f3rog.ui.custom; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Parcelable; | |
import android.support.annotation.Nullable; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.AttributeSet; | |
/** |
This file contains 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
# Terminal Cheat Sheet | |
pwd # print working directory | |
ls # list files in directory | |
cd # change directory | |
~ # home directory | |
.. # up one directory | |
- # previous working directory | |
help # get help | |
-h # get help |
This file contains 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
package org.cnii.layoutloader.ui; | |
import android.content.Context; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; | |
import android.view.View; | |
/** | |
* Special thanks to Daniel López Lacalle for his response | |
* (http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content/20784791#20784791) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)
Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.
NewerOlder