Skip to content

Instantly share code, notes, and snippets.

View NitinPraksash9911's full-sized avatar
🎯
Focusing

Nitin Prakash NitinPraksash9911

🎯
Focusing
View GitHub Profile
@NitinPraksash9911
NitinPraksash9911 / Automate Baseline profiler generator script
Last active October 19, 2022 16:23
This can be used whenever releasing app we have to generate the baseline profile for app-startup time improvement so this script remove overhead of manual doing all the stesp
#!/bin/sh
# this will exit the script if any command fails
set -e
set -o pipefail
## FOLLOW THIS STEPS FIRS TO SET EVN VARIABLE FOR THE FOLLOWING COMMANDS
# Set android home path
export ANDROID_HOME=~/Library/Android/sdk
@Singleton
class ApiFactory @Inject constructor() {
/**
* [apiBaseUrl]
* because we are adding it from parameter in the request
* */
private val apiBaseUrl = BuildConfig.BASE_URL
private var retrofit: Retrofit? = null
@NitinPraksash9911
NitinPraksash9911 / UnzipUtils.kt
Last active October 17, 2024 13:46
Unzipping file in android/kotlin
import java.io.*
import java.util.zip.ZipFile
/**
* UnzipUtils class extracts files and sub-directories of a standard zip file to
* a destination directory.
*
*/
object UnzipUtils {
interface Reader {
fun read():Char
}
interface Writer {
fun write(ch Char)
}
public fun copy(r Reader, w Writer ){
var ch Char
enum OutputDevice {PRINTER, DISK}
public fun copy(OutputDevice dev){
val c:int
while((c=readKeyBoard)!=EOF){
if(dev==PRINTER)
{
writePrinter(c)
}else{
writeToDisk(c)
interface Robot {
fun reset()
}
interface Flyable {
fun fly()
}
interface Talkable {
fun talk()
interface Robot {
fun reset()
fun fly()
fun talk()
}
class ButterflyRobot : Robot {
override fun reset() {
TODO("not implemented")
public interface Car {
void accelerate();
}
public interface EngineType {
void turnOnEngine();
}
/***********************/
public class ElectricCar implements Car {
public void turnOnEngine() {
throw new AssertionError("I don't have an engine!");
}
public void accelerate() {
//this acceleration is crazy!
}
}
public interface Car {
void turnOnEngine();
void accelerate();
}
public class MotorCar implements Car {
private Engine engine;