Skip to content

Instantly share code, notes, and snippets.

Jorge Garrido FireZenk

Block or report user

Report or block FireZenk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FireZenk
FireZenk / GenericSwipeCallback.kt
Created Apr 26, 2018
Swipe DSL kotlin-android
View GenericSwipeCallback.kt
import android.graphics.Canvas
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.helper.ItemTouchHelper
import android.support.v7.widget.helper.ItemTouchHelper.*
import android.view.View
abstract class GenericSwipeCallback(
private var swipeLeft: SwipeAction? = null,
private var swipeRight: SwipeAction? = null
) : ItemTouchHelper.Callback() {
@FireZenk
FireZenk / bot.js
Created Nov 19, 2013
Twitter bot using node.js and twit module to retweet interesting info of node.js
View bot.js
//
// Bot
// class for performing various twitter actions
//
var Twit = require('../lib/twitter');
var Bot = module.exports = function(config) {
this.twit = new Twit(config);
};
@FireZenk
FireZenk / TimberExt.kt
Created Mar 29, 2019
Dumps the Android Intent content on Timber
View TimberExt.kt
import android.content.Intent
import timber.log.Timber
fun dumpIntent(intent: Intent) {
val bundle = intent.extras
if (bundle != null) {
val keys = bundle.keySet()
val it = keys.iterator()
Timber.e("------->>> Dumping Intent start")
while (it.hasNext()) {
@FireZenk
FireZenk / gzip.kts
Last active Nov 22, 2018 — forked from sgdan/gzip.kts
Kotlin code to compress/uncompress a string with gzip
View gzip.kts
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun String.gzip(): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(this) }
return bos.toByteArray()
@FireZenk
FireZenk / TextViewExt.kt
Created Nov 15, 2018
A collection of TexView extension functions (justify fun for now)
View TextViewExt.kt
import android.text.Spanned
import android.text.style.ImageSpan
import android.graphics.drawable.ColorDrawable
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.widget.TextView
import java.util.concurrent.atomic.AtomicBoolean
fun TextView.justify() {
@FireZenk
FireZenk / RxSocketConnection.java
Created Dec 21, 2016
A working example of reactive implementation of a socket connection using okhttp3 socket api
View RxSocketConnection.java
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import rx.Observable;
public class RxSocketConnection extends WebSocketListener {
@FireZenk
FireZenk / ToolbarSearchDsl.kt
Created Apr 26, 2018
Toolbar Search dsl kotlin-android
View ToolbarSearchDsl.kt
import android.support.annotation.IdRes
import android.support.v7.widget.SearchView
import android.support.v7.widget.Toolbar
import android.view.MenuItem
@DslMarker
annotation class ToolbarSearchDsl
@ToolbarSearchDsl
@FireZenk
FireZenk / SnackbarAnimation.java
Last active Feb 26, 2018
With this class you can clone the {Snackbar} animation to move the {ViewGroup} above of the Snackbar when it is visible and avoid view overlapping (clone of fab animation)
View SnackbarAnimation.java
package com.your.package;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.view.ViewGroup;
import com.daimajia.easing.BaseEasingMethod;
import com.daimajia.easing.Glider;
import com.daimajia.easing.Skill;
import com.nineoldandroids.animation.AnimatorSet;
@FireZenk
FireZenk / WebSocket.kt
Created Jan 11, 2018
websocket.org rx implementation
View WebSocket.kt
object WebSocket : WebSocketListener() {
private lateinit var broadcaster: FlowableEmitter<String>
private lateinit var disposable: Disposable
private lateinit var webSocket: WebSocket
private val flowable = Flowable.create(FlowableOnSubscribe<String> { emitter -> broadcaster = emitter }, BackpressureStrategy.BUFFER)
fun subscribe(): Flowable<String> {
val client = OkHttpClient.Builder()
.readTimeout(0, TimeUnit.MILLISECONDS)
@FireZenk
FireZenk / SignalrSocket.kt
Created Jan 11, 2018
Signalr socket rx implementation
View SignalrSocket.kt
object SignalrSocket {
private lateinit var broadcaster: FlowableEmitter<String>
private lateinit var disposable: Disposable
private val flowable = Flowable.create(FlowableOnSubscribe<String> { emitter -> broadcaster = emitter }, BackpressureStrategy.BUFFER)
private lateinit var mHubConnection: HubConnection
private lateinit var mHubProxy: HubProxy
@Throws(InterruptedException::class, ExecutionException::class)
You can’t perform that action at this time.