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
{
"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
{
"Boolean_literal": "<p>Jika menggunakan Boolean untuk ekspresi, Anda tidak perlu lagi menuliskan nilainya.&nbsp;Cukup seperti di bawah ini:</p><pre><code>if (sleep){<br> ...<br>}</code></pre>",
"Overlap_view": "Perbaiki overlap view yang terjadi pada halaman <strong>xxx</strong> seperti berikut.",
"Binding_leaks": "Hindari mendeklarasi kelas Binding dengan <span style=\"padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-radius: 4px;\">lateinit</span> karena hanya akan menyebabkan <em>memory leaks</em>. Untuk detail pembahasannya bisa dibaca <a href=\"https://proandroiddev.com/avoiding-memory-leaks-when-using-data-binding-and-view-binding-3b91d571c150\" target=\"_blank\" rel=\"noopener noreferrer\">di sini</a>.",
"Suspending_function": "Kode yang ditambahkan pada TODO ini masih belum lengkap. Seharusnya fungsi ini dijadikan <em>suspending function.</em>&nbsp;",
"Multiple_observer": "Fungsi <span style=\"padding: 2px 4px; color: rgb(199, 37, 78); background-color: rgb(24
{
"Boolean_literal": "<p>Jika menggunakan Boolean untuk ekspresi, Anda tidak perlu lagi menuliskan nilainya.&nbsp;Cukup seperti di bawah ini:</p><pre><code spellcheck=\"false\">if (sleep){</code><br><code spellcheck=\"false\">...</code><br><code spellcheck=\"false\">}</code></pre>",
"Overlap_view": "Perbaiki overlap view yang terjadi pada halaman <strong>xxx</strong> seperti berikut.",
"Suspending_function": "Kode yang ditambahkan pada TODO ini masih belum lengkap. Seharusnya fungsi ini dijadikan <em>suspending function.</em>&nbsp;",
"Pesan_keterangan": "Pastikan kembali pesan yang akan ditampilkan dapat dimengerti dengan baik oleh pengguna.",
"Material_design_references": "Mulailah untuk menerapkan konsep Material Design ketika mengembangkan proyek Aplikasi.&nbsp;Kamu&nbsp;bisa mengunjungi&nbsp;<a data-target-href=\"https://www.material.io/\" href=\"https://www.material.io/\" rel=\"noreferrer nofollow noopener\" target=\"_blank\">www.material.io</a> sebagai referensi.",
"Unused_variable_di_datacl