Skip to content

Instantly share code, notes, and snippets.

View herisulistiyanto's full-sized avatar
:octocat:
Working from home

heri sulistiyanto herisulistiyanto

:octocat:
Working from home
View GitHub Profile
abstract class BaseDataSource {
protected suspend fun <T> getResult(call: suspend () -> Response<T>): ResponseResult<ResponseWrapper<T>> {
try {
val response = call()
if (response.isSuccessful) {
val body = response.body()
if (null != body) return ResponseResult.Success(ResponseWrapper(body, null))
}
return error("${response.code()} ${response.message()}")
interface MovieApiService {
@GET("/3/discover/movie")
suspend fun discoverAllMovies(): Response<MovieResponse>
@GET("/3/movie/{movieId}")
suspend fun getMovieDetail(@Path("movieId") movieId: Int): Response<MovieDetailResponse>
}
fun main() {
val shotGun = ShotGun("S12K", "Brown").apply {
projectile = 3
}
val deagle = Deagle("Deagle", "Red").apply {
projectile = 3
}
val snipper = Snipper().apply {
@herisulistiyanto
herisulistiyanto / index.js
Created January 6, 2018 17:14
scrapping data
const cheerio = require('cheerio');
const axios = require('axios');
var qs = require('qs');
const fs = require('fs');
const dist_file_dir = 'dist/';
let provinsi = [];
let kabupaten = [];
let kecamatan = [];