Skip to content

Instantly share code, notes, and snippets.

View egek92's full-sized avatar
🔵

Ege Kuzubasioglu egek92

🔵
View GitHub Profile
@namhyun-gu
namhyun-gu / BasicAuth.kt
Last active November 7, 2022 15:13
Basic Auth (Okhttp3)
// 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()
@hleinone
hleinone / CreditCardNumberFormattingTextWatcher.kt
Last active November 30, 2023 14:03
Android EditText TextWatcher for formatting credit card number made with Kotlin
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) {
@Ferrmolina
Ferrmolina / SomeActivityClass.java
Created May 24, 2016 03:56
Get Name, ID and Email - Facebook SDK - Android
@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(
@FrantisekGazo
FrantisekGazo / StatefulRecyclerView.java
Last active July 6, 2023 21:02
Retain & restore recycler view scroll position
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;
/**
@aggrolite
aggrolite / redditbot.md
Last active January 6, 2022 13:44
Writing a reddit bot with Go and OAuth2
@cferdinandi
cferdinandi / terminal-cheat-sheet.txt
Last active April 15, 2024 17:49
Terminal Cheat Sheet
# 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
@egslava
egslava / WrapContentHeightViewPager.java
Created August 12, 2014 12:28
Wrap content height ViewPager (Android)
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)
@staltz
staltz / introrx.md
Last active April 15, 2024 10:24
The introduction to Reactive Programming you've been missing
@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

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.)

Code Example

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.

Motivation