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 on Jul 31, 2013 | |
@author: gawcio | |
''' | |
import sys, json, xmpp, random, string | |
SERVER = 'gcm.googleapis.com' | |
PORT = 5235 |
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
public static void main(String... args) throws IOException { | |
String host = args[0]; | |
int port = Integer.parseInt(args[1]); | |
String botName = args[2]; | |
String botKey = args[3]; | |
System.out.println("Connecting to " + host + ":" + port + " as " | |
+ botName + "/" + botKey); | |
//final Socket socket = new Socket(host, port); |
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
package pl.lgawin.guavasandbox.equivalence; | |
import static com.google.common.base.MoreObjects.toStringHelper; | |
import static com.google.common.base.Objects.equal; | |
import com.google.common.base.Objects; | |
import com.google.common.net.MediaType; | |
public class RemoteObject { |
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
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:width="24dp" | |
android:height="24dp" | |
android:tint="?attr/colorControlNormal" | |
android:viewportHeight="24.0" | |
android:viewportWidth="24.0"> | |
<path | |
android:fillColor="#ff000000" | |
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z" /> | |
</vector> |
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
private inline val Calendar.year: Int | |
get() = get(Calendar.YEAR) | |
private inline val Calendar.month: Int | |
get() = get(Calendar.MONTH) | |
private inline val Calendar.day: Int | |
get() = get(Calendar.DAY_OF_MONTH) |
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
@BindingAdapter("date") | |
fun setDate(datePicker: DatePicker, value: LocalDate) { | |
if (value != LocalDate.of(datePicker.year, datePicker.month + 1, datePicker.dayOfMonth)) { | |
datePicker.updateDate(value.year, value.monthValue - 1, value.dayOfMonth) | |
} | |
} | |
@BindingAdapter(value = ["dateAttrChanged", "onDateChanged"], requireAll = false) | |
fun setDateChangeListener( | |
datePicker: DatePicker, |
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
import androidx.databinding.ObservableList | |
import androidx.recyclerview.widget.DiffUtil | |
import me.tatarka.bindingcollectionadapter2.collections.AsyncDiffObservableList | |
import me.tatarka.bindingcollectionadapter2.collections.DiffObservableList | |
@Suppress("NOTHING_TO_INLINE", "FunctionName") | |
inline fun <T : Any> DiffObservableList( | |
itemCallback: DiffUtil.ItemCallback<T>, | |
async: Boolean = true | |
): DiffList<T> = |
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
import androidx.recyclerview.widget.DiffUtil | |
import kotlin.reflect.KProperty1 | |
@Suppress("NOTHING_TO_INLINE") | |
inline fun <T : Any, R: Any> byProperty(kProperty: KProperty1<T, R>): (T, T) -> Boolean = | |
{ old, new -> kProperty.get(old) == kProperty.get(new) } | |
@Suppress("FunctionName") | |
inline fun <T : Any> DiffItemCallback( | |
crossinline areItemsTheSame: (T, T) -> Boolean, |
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
import android.app.Activity | |
import android.view.View | |
import androidx.annotation.IdRes | |
import androidx.fragment.app.Fragment | |
fun <T : View> Activity.findView(@IdRes res : Int) : Lazy<T> { | |
@Suppress("UNCHECKED_CAST") | |
return lazy(LazyThreadSafetyMode.NONE){ findViewById<T>(res) } | |
} |
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
package com.example.android.testing.blueprint | |
import android.content.res.AssetManager | |
import okhttp3.Interceptor | |
import okhttp3.MediaType.Companion.toMediaType | |
import okhttp3.OkHttpClient | |
import okhttp3.Protocol | |
import okhttp3.Request | |
import okhttp3.Response | |
import okhttp3.ResponseBody.Companion.toResponseBody |
OlderNewer