Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Septian Adi Wijaya 4sskick

🏠
Working from home
View GitHub Profile
@4sskick
4sskick / SQLite migration room db - android
Created Mar 22, 2022
short tips on doing migration mobile development using room DB
View SQLite migration room db - android
this process (mgration) is a vital step need to defined very serious.
after setup library room db on android you need to make sure to export schema everytime it changes.
see mine here:
---
build.gradle (app)
---
defaultConfig {
//schema provide for DB room
javaCompileOptions {
annotationProcessorOptions {
View pipenv python - step to activate
These virtual environment seems less informative for me as beginner, compared to virtualenv which I installed [here](https://pythonbasics.org/virtualenv/)
To activate virtual environment, you need to go specific folder project. Then type `pipenv shell`
if there's no virtual env activated yet, output would become `Launching subshell in virtual environment...`
but if there's one activate already, would give an output `Shell for [location project] like C:\Users\monta\.virtualenvs\django-test-LGyddycI already activated`
When that's happen, you need to locate the orject which virtual env point on that location then type `exit`
YES! just type exit. If terminal you use not closed yet. Then virtual env the one activated already would become `deactivate` by doing that
NOW, let's go to basic.
HOW TO CREATE NEW PROJECT USING PIPENV
@4sskick
4sskick / composer php via docker
Created Feb 18, 2022
use composer via docker
View composer php via docker
I'm working on project php based (sepc. code igniter 3), which composer gonna be a tools to install dependencies/library. But i don't want to install it on my local.
so I decide to using container as my virtual environment, to do that you can see my Dockerfile on my project here https://github.com/4sskick/infra/blob/master/php-cli/Dockerfile
on the last line, I add command to run curl command to install composer that will attached on my container I'm gonna built after.
to use command composer, you can folllow this command:
- see container ID by command `docker container ls`
- if you use my project infra on my github, it would be using `docker-compose up` to run all services, then see on section ck_php there would be container ID after hit command `docker container ls`
attach the container by command `docker exec -it <container-ID> sh -c "composer --version" `
- it gonna print you the version of composer installed then exit after done
- everytime you need to use composer, you need to hit command `docker exec -
@4sskick
4sskick / rebuilt docker container
Created Feb 18, 2022
rebuilding container docker
View rebuilt docker container
this case happen when you already run the exsting container docker, then you gonna edit the config by add another image via `COPY --from=<image-docker> /src /dst` or something else
to get latest version of container you've already edit, you need to rebuit it by command `docker-compose up -d --no-deps --build <service-name-on-docker-compose.yml>`
it gonna recreate container from beginning, based on this `https://stackoverflow.com/questions/36884991/how-to-rebuild-docker-container-in-docker-compose-yml`
View setup adb through wifi
this method could be usefull when you only have 1 cable to connect through device, but you wanna see log for more than one device. You are able to connect many devices in same time as long on same network.
- make sure you already define ADB to be called on terminal, type `adb device` to check what devices on list.
- connect you physical device with cable until their serial number appeared on command `adb devices`
- begin with command `adb -s <serial_num_physical> tcpip <port_you_wanna_use, ex: 1230>`
- terminal would log output `restarting in TCP mode port: 1230`, itrestarting connection through cable USB on physical device
- continue with looking for IP address physical device which connect on same network `adb -s <serial_num_physical> shell "ip addr show wlan0 | grep -e wlan0$"
- it gonna log output like, `inet 192.168.100.45/24 brd 192.168.100.255 scope global wlan0`
- begin to connect using IP address, `adb -s <serial_num_physical> connect <ip_address>:<port_you_defined>`
- if run well, terminal would lo
@4sskick
4sskick / Convert Java To Kotlin
Last active Oct 11, 2021
trial error converting java to kotlin project pow-waiter
View Convert Java To Kotlin
- first trial on converting into Kotlin (1.5.31) directly from Android Studio git error `Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'kotlin-android'] and this `Caused by: org.gradle.api.GradleException: The current Gradle version 5.4.1 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin.` ssems the point to solve
- it accessed via right click on package then choose convert to kotlin
- I change `distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip` on file `gradle-wrapper.properties` to recommendation version number
- with result, `Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'realm-android']` and another `Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'kapt' not found.`
- I add these lines: `apply plugin: 'kotlin-android'` `apply plugin: 'kotlin-android-exten
View setup prettier vscode
in vscode I already formetter beautify to format whenever I saved change on files. But while I work with react native, plugin Beautify can't handle to format the code. I don't know why.
I decide to install another plugin formatter, called 'prettier'. To install it foollow the command:
- type ctr+shift+P it gonna open bar tab on the fly to execute some commands
- type `install extension` and Enter
- look for Prettier - Code formatter then install. Wait till finished
- you need to setup to make pretiier work for default formatter whenever you code
- open setting, by navigate cursor on `file -> preferences -> settings` look for `edit in settings.json` on tab extensions
- change into `"editor.defaultFormatter": "esbenp.prettier-vscode"` also `"editor.formatOnSave": true,` and `"prettier.eslintIntegration": true,`
- restart vscode by type `ctrl+shift+P` type `reload windows`
@4sskick
4sskick / Jacoco Setup Android
Last active Oct 5, 2021
Jacoco setup report coverage
View Jacoco Setup Android
see here https://medium.com/nerd-for-tech/setup-jacoco-code-coverage-with-your-multimodule-android-app-kotlin-a0f82573a1
exclude file agregation here https://liviutudor.com/2016/02/11/jacoco-gradle-excluding-source-files-and-classes/
@4sskick
4sskick / Android parameterize test
Last active Oct 5, 2021
unit test with parameter input
View Android parameterize test
as regular test using unit test we can use jUnit roboelectric Mockito etc. There are some condition which class with parameter more than 1
ex. inteface class
`double getPriceAfterSurcharge(double baseCost, double surchargeFixedPrice, double surchargePercentage, Integer quantity);`
implementation class:
@Override
public double getPriceAfterSurcharge(double baseCost, double surchargeFixedPrice,
double surchargePercentage, Integer quantity) {
double productPrice;
@4sskick
4sskick / nvm setup with windows 10
Created Oct 4, 2021
NVM setup with windows 10
View nvm setup with windows 10
- take a look git repo [over here](https://github.com/coreybutler/nvm-windows/releases)
- or you can see mine I've downloaded [here](https://bit.ly/nvmSetup) version 1.1.17
- finished downloaded, execute & follow installation as regular
- finished installation, check with command `nvm --version` if doesn't show anything try to restart windows
- check again till version `nvm --version` shown
- install node version you wanna use with command `nvm install node_version` it will download required files node js along with NPM
- finished installed node_version, then type `nvm use node_version` you just installed
- type `nvm list` to see node version installed you able to use directly
- or `nvm list available` to see all list you ready to install with version LTS and latest version
- DONE