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 com.vinted.feature.base.ui.rx | |
import io.reactivex.Observable | |
import io.reactivex.Observer | |
import io.reactivex.disposables.Disposable | |
/** | |
* | |
* Breaks dispose chain. Upstream will be not be disposed. | |
* This class should be used in cases where you need guarantee upstream will be executed at any price. |
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
@Test(timeout = 10000) | |
fun secondSubscription_returnsImmediate() { | |
val subject = PublishSubject.create<Int>() | |
val cachedSubject = subject.successOnlyCache() | |
cachedSubject.test() //first subscription | |
cachedSubject.test() //second subscription | |
//this method will never finishes if subscription is blocked. | |
} |
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 com.vinted.drawables | |
import android.content.res.ColorStateList | |
import android.graphics.* | |
import android.graphics.drawable.Drawable | |
import android.text.DynamicLayout | |
import android.text.Editable | |
import android.text.Layout | |
import android.text.TextPaint |
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 com.neworldwar | |
import com.neworldwar.utils.Random | |
import org.junit.jupiter.api.BeforeAll | |
import org.junit.jupiter.api.RepeatedTest | |
import org.junit.jupiter.api.TestInstance | |
const val REQUESTS = 100 | |
const val TOTAL_DEPENDENCIES = 1000 | |
const val DEPENDENCIES_PER_REQUEST = 100 |
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
val checkLock = Object() | |
val disposeLock = Object() | |
val completable = Completable.create { emitter -> | |
synchronized(checkLock) { | |
checkLock.notify() | |
} | |
if (!emitter.isDisposed) { | |
synchronized(disposeLock) { | |
try { |
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
send(to, from, count) | |
register short *to, *from; | |
register count; | |
{ | |
register n = (count + 7) / 8; | |
switch (count % 8) { | |
case 0: do { *to = *from++; | |
case 7: *to = *from++; | |
case 6: *to = *from++; | |
case 5: *to = *from++; |
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
data Tree a = Empty | Tree a (Tree a) (Tree a) deriving (Show) | |
singleton :: a -> Tree a | |
singleton x = Tree x Empty Empty | |
addToTree :: (Ord a) => a -> Tree a -> Tree a | |
addToTree new Empty = singleton new | |
addToTree new (Tree value left right) | |
| new < value = Tree value (addToTree new left) right | |
| otherwise = Tree value left (addToTree new right) |
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
public class TimedDynamicText extends SpannableStringBuilder { | |
private final ArrayDeque<Pair<Integer, CharSequence>> list; | |
private Handler handler = new Handler(); | |
private CharSequence nextText = ""; | |
public TimedDynamicText(CharSequence initialText, Collection<Pair<Integer, CharSequence>> list) { | |
this.list = new ArrayDeque<>(list); | |
nextText = initialText; | |
next(); |
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
// ==UserScript== | |
// @name Markdown img to html converter | |
// @namespace neworld | |
// @version 0.2.0 | |
// @description Converts markdown img tag to html | |
// @author Neworld | |
// @match https://*.github.com/* | |
// @grant none | |
// @run-at context-menu | |
// ==/UserScript== |
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
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# | |
# *) local and remote branch names | |
# *) local and remote tag names |
NewerOlder