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 kotlinx.coroutines.* | |
import kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.channels.* | |
fun main() = runBlocking<Unit> { | |
// create a Channel with a buffer of size 20 | |
// this means that until 20 the send() are not suspending waiting for a receive() | |
val channel = Channel<String>(20) | |
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 class BinaryOperationsAndBitmasks { | |
public static void main(String[] args) { | |
new BinaryOperationsAndBitmasks().bitsOperations(); | |
} | |
/** | |
* Basic bitmap operations | |
*/ | |
private void bitsOperations() { |
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
/* | |
Our function f(x) | |
*/ | |
function f(x) { | |
return x*x +5; | |
} | |
/* | |
The derivative df/dx of our function f(x) | |
*/ |
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
android { | |
applicationVariants.all { variant -> | |
def versionCode = android.defaultConfig.versionCode | |
def versionName = android.defaultConfig.versionName | |
def appendToFileName = versionName + "-build-" + versionCode | |
// copy and rename mapping.txt file if in minify is enable | |
if (variant.getBuildType().isMinifyEnabled()) { | |
variant.assemble.doLast{ | |
copy { |
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 org.mockito.Mock; | |
import static org.mockito.Mockito.when; | |
@Mock | |
private Context mockApplicationContext; | |
@Mock | |
private Resources mockContextResources; | |
@Mock | |
private SharedPreferences mockSharedPreferences; |
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
def bits_converter(x): | |
index = 0 | |
bits = "" | |
while x is not 0: | |
bits += str(x & 1) | |
x = x >> 1 | |
index+=1 | |
return bits[::-1] |
NewerOlder