Skip to content

Instantly share code, notes, and snippets.

View pratamawijaya's full-sized avatar

Pratama Nur Wijaya pratamawijaya

View GitHub Profile
[
{
"name": "SofleKeyboard",
"author": "Josef Adamcik",
"switchMount": "cherry"
},
[
{
"y": 0.2,
"x": 3,
@pratamawijaya
pratamawijaya / build.gradle.kts
Created September 5, 2023 06:08 — forked from shahzadansari/build.gradle.kts
Custom gradle task which copies app-debug.apk to Desktop and renames it to Git's current checked out branch
// 1. Add following snippet in your build.gradle.kts(:app)
// Run this command in terminal -> ./gradlew copyDebugApkToDesktop
tasks.register("copyDebugApkToDesktop") {
dependsOn("assembleDebug")
doLast {
val sourceDir = "build/outputs/apk/debug/app-debug.apk"
val desktopDir = System.getProperty("user.home") + "/Desktop/"
val gitBranch = try {
@pratamawijaya
pratamawijaya / README.md
Created November 9, 2022 03:07 — forked from jhonsore/README.md
Upload an Image from camera or gallery in WebView

This is an old way to Upload an Image from camera or gallery in WebView. It was made a long time ago and is not maintened anymore. Use it at your own risk.

@Composable
fun CalendarView(
modifier: Modifier = Modifier,
selectedDay: CalendarDay = CalendarDay.create(),
onSelectedDayChange: (CalendarDay) -> Unit = {},
visibleMonth: CalendarDay = CalendarDay.create(),
onVisibleMonthChange: (CalendarDay) -> Unit = {},
today: CalendarDay = CalendarDay.create(),
events: Set<CalendarDay> = emptySet()
) {
@pratamawijaya
pratamawijaya / PreferenceExtensions.kt
Created November 14, 2019 10:37 — forked from ologe/PreferenceExtensions.kt
Android shared preference observer using kotlin coroutines (1.3.0)
inline fun <reified T> SharedPreferences.observeKey(key: String, default: T, dispatcher: CoroutineContext = Dispatchers.Default): Flow<T> {
val flow: Flow<T> = channelFlow {
offer(getItem(key, default))
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, k ->
if (key == k) {
offer(getItem(key, default)!!)
}
}
@pratamawijaya
pratamawijaya / medium_rider_redesign_blog_example.kt
Created October 21, 2018 12:32 — forked from abhaysood/medium_rider_redesign_blog_example.kt
A simple component which is created when user clicks the cancel order button in the app. It is responsible for showing a confirmation dialog and actually cancelling the order by making an API call.
class OrderCancellationComponent(private val context: Context,
private val api: Api,
private val orderNumber: String) {
interface Callbacks {
fun onOrderCancelledSuccessfully()
fun onOrderCancellationFailed()
}
var callbacks: Callbacks? = null // Callbacks for communication with the parent component
@pratamawijaya
pratamawijaya / sketch-never-ending.md
Created April 18, 2018 09:32 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@pratamawijaya
pratamawijaya / sign_apk.sh
Created January 24, 2018 09:09 — forked from caingougou/sign_apk.sh
Create keystore file and sign a jar file (or android package)
# create keystore file
keytool -genkey -v -keystore [my-release-key].ketstore -keyalg RSA -validity 1000 -alias [some_alias]
# sign package
jarsigner -keystore my-release-key.ketstore [some-release-unsigned.apk] some_alias
# verify signed package
jarsigner -verify [some-release-unsigned.apk]
@pratamawijaya
pratamawijaya / GoogleMapsGeocodingHelper.kt
Created November 4, 2017 01:58 — forked from matteo-grella/GoogleMapsGeocodingHelper.kt
A Kotlin wrapper for the Google Maps Geocoding API v3
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
h scroll left
j scroll down
k scroll up
l scroll right
gg scroll to top of the page
G scroll to bottom of the page
f activate link hints mode to open in current tab
F activate link hints mode to open in new tab
r reload