Skip to content

Instantly share code, notes, and snippets.

View alfianyusufabdullah's full-sized avatar
📚
Sometimes playing with Code & Fish

Alfian Yusuf Abdullah alfianyusufabdullah

📚
Sometimes playing with Code & Fish
View GitHub Profile
{"data":"approved","code":["funmain(){valvalueA=101valvalueB=52valvalueC=99valresultA=calculateResult(valueA,valueB,valueC)valresultB=calculateResult(valueA,valueB,null)println(\"\"\"ResultAis$resultAResultBis$resultB\"\"\".trimIndent())}funcalculateResult(valueA:Int,valueB:Int,valueC:Int?):Int{//TODOvalvalueC=if(valueC!=null)valueCelse50valresult=valueA+(valueB-valueC)returnresult}","funmain(){//TODO1valvehicle=mapOf<String,String>(\"type\"to\"Motorcycle\",\"maxSpeed\"to\"230Km/s\",\"maxTank\"to\"10Ltr\")//TODO2valtype=(vehicle[\"type\"])valmaxSpeed=(vehicle[\"maxSpeed\"])valmaxTank=(vehicle[\"maxTank\"])//TODO3println(\"Vehicle\")println(\"Type:$type\")println(\"MaximalSpeed:$maxSpeed\")println(\"MaximalTank:$maxTank\")}","funmain(){valkotlin=\"Kotlin\".getFirstAndLast()valdicoding=\"Dicoding\".getFirstAndLast()valkotlinFirstChar=kotlin[\"first\"]valkotlinLastChar=kotlin[\"last\"]valdicodingFirstChar=dicoding[\"first\"]valdicodingLastChar=dicoding[\"last\"]println(\"FirstcharKotlinis$kotlinFirstCharand$kotl
{
"submission": {
"approved": [
"/***Untukmenyelesaikantugaslatihan,Andatidakdiperbolehkanmengubahstrukturkodeyangsudahada.Kecuali:*-Untukmelakukanimprovisasikode*-Mengikutiperintahyangada**Cukuptambahkankodeberdasarkanperintahyangsudahditentukan.**/funmain(){vallistNumber=1.rangeTo(100)for(numberinlistNumber){//TODO1if(number%2==0)continue//TODO2if(number>15)break//TODO3valresult=number*(number+10)println(\"rangeresultis$result\")}}",
"/***Untukmenyelesaikantugaslatihan,Andatidakdiperbolehkanmengubahstrukturkodeyangsudahada.Kecuali:*-Untukmelakukanimprovisasikode*-Mengikutiperintahyangada**Cukuptambahkankodeberdasarkanperintahyangsudahditentukan.**/importkotlinx.coroutines.*//TODO1suspendfunsum(valueA:Int,valueB:Int):Int{delay(3000)returnvalueA+valueB}//TODO2suspendfunmultiple(valueA:Int,valueB:Int):Int{delay(2000)returnvalueA*valueB}funmain()=runBlocking{println(\"Counting...\")valresultSum=async{sum(10,10)}valresultMultiple=async{multiple(20,20)}//TODO3println(\"Resultsum:${resultSum.awai
{
"codes" : {
"-MjFEffYhKc4a5lxctG6" : {
"code" : "importorg.junit.Assertimportorg.junit.TestclassTest{privatefun<T>checkFunction(args:T){valresult=when(args){isString->args.lengthisInt->args*5else->0}Assert.assertEquals(\"FungsigetResultseharusnyamengembalikannilai$result\",result,getResult(args))}@Testfuntest1()=checkFunction(\"Kotlin\")@Testfuntest2()=checkFunction(true)@Testfuntest3()=checkFunction(10)@Testfuntest4()=checkFunction(0x01)@Testfuntest5()=checkFunction(false)@Testfuntest6()=checkFunction(10L)@Testfuntest7()=checkFunction('A')@Testfuntest8()=checkFunction(100110)}"
},
"-MjFEffZS31QU8c3V55w" : {
"code" : "funmain(){println(\"\"\"Kotlin,|isAwesome!\"\"\".trimMargin())}"
},
"-MjFEfguDW41sHZxajb9" : {
"code" : "importkotlin.reflect.typeOf/***Untukmenyelesaikantugaslatihan,Andatidakdiperbolehkanmengubahstrukturkodeyangsudahada.Kecuali:*-Untukmelakukanimprovisasikode*-Mengikutiperintahyangada**Cukuptambahkankodeberdasarkanperintahyangsudahditentukan.**/funmain
@alfianyusufabdullah
alfianyusufabdullah / desc.md
Last active July 30, 2021 01:15
Lorem ipsum

Prototyping Flow

Saat halaman detail review dibuka, extensions akan mengirimkan ping menggunakan websocket untuk memastikan ketersediaan aplikasi untuk merender tampilan. Berikut adalah data yang dibawa ketika melakukan ping.

{
  "type": "ping",
  "id": 123,
  "name": "Belajar Dasar Pemrograman Web"
}
[{"name":"[Mandatory] Add Book With Complete Data","method":"POST","request":"http://localhost:{{port}}/books/","messages":["status code should be 201 | expected response to have status code 201 but got 500","response body should have correct property and value | expected { Object (status, message) } to have own property 'data'","response body data should contain bookId | Target cannot be null or undefined."]},{"name":"[Mandatory] Add Book Without Name","method":"POST","request":"http://localhost:{{port}}/books/","messages":["status code should be 400 | expected response to have status code 400 but got 500"]},{"name":"[Mandatory] Add Book with Page Read More Than Page Count","method":"POST","request":"http://localhost:{{port}}/books/","messages":["status code should be 400 | expected response to have status code 400 but got 500","response body should have correct property and value | expected 'Gagal menambahkan buku. Mohon isi nama buku' to equal 'Gagal menambahkan buku. readPage tidak boleh lebih besar dari
let tabId
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
if (chrome.runtime.lastError){
console.log(chrome.runtime.lastError.message);
return
}
tabId = sender.tab.id
sendResponse("Message Received!")
});
{"source":"beny","target":"beny","percentage":"86.0%","comparison":[{"token":"20","sourceFilename":"MovieAdapter.kt(1-71)","targetFilename":"MovieAdapter.kt(1-71)","sourceCode":"package com.beny.movieapp.data.source\n\nimport androidx.lifecycle.LifecycleOwner\nimport androidx.lifecycle.LiveData\nimport androidx.paging.PagedList\nimport com.beny.movieapp.data.source.local.entity.MovieEntity\nimport com.beny.movieapp.data.source.local.entity.TvshowEntity\nimport com.beny.movieapp.vo.Resource\n\ninterface MovieDataSource {\n\n fun getAllMovies(owner: LifecycleOwner): LiveData<Resource<PagedList<MovieEntity>>>\n\n fun getMovie(movieId: String,owner: LifecycleOwner): LiveData<Resource<MovieEntity>>\n\n fun getAllTv(owner: LifecycleOwner): LiveData<Resource<PagedList<TvshowEntity>>>\n\n fun getTv(tvId: String,owner: LifecycleOwner): LiveData<Resource<TvshowEntity>>\n\n fun getFavoriteMovie(): LiveData<PagedList<MovieEntity>>\n\n fun getFavoriteTvshow(): LiveData<PagedList<TvshowEntity>>\n\n fun
@alfianyusufabdullah
alfianyusufabdullah / FilesDetectionsListener.kt
Created June 1, 2021 13:04
RFE Android Studio Plugin source code
package com.platfom.sync
import com.intellij.openapi.Disposable
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.editor.event.EditorMouseEvent
import com.intellij.openapi.editor.event.EditorMouseListener
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
import com.intellij.openapi.fileEditor.FileEditorManagerListener
import com.intellij.openapi.vfs.VirtualFile
@alfianyusufabdullah
alfianyusufabdullah / frontend.js
Last active June 1, 2021 13:00
RFE Extensions source code
const popupAutoComplete = document.createElement("div")
const connectedToObserve = document.createElement("strong")
var popupLeftMargin = 0
var popupWidth = 0
var popupIsShow = false
var recentScrollPosition = 0
let popupItemsData = new Map()
let placeholder = ""
@RunWith(MockitoJUnitRunner::class)
class TvShowViewModelTest {
private lateinit var viewModel: TvShowViewModel
@get:Rule
var instantTaskExecutorRule = InstantTaskExecutorRule()
@Mock
private lateinit var catalogueRepository: CatalogueRepository