Languages and Tools:
import { auth } from '@pengode/auth' | |
const getBearer = async () => { | |
const session = await auth() | |
if (!session?.user.accessToken) return | |
return `Bearer ${session.user.accessToken}` | |
} |
type Null[T any] struct { | |
Value T | |
Valid bool | |
Set bool | |
} | |
func (n *Null[T]) UnmarshalJSON(data []byte) error { | |
n.Set = true | |
if string(data) == "null" { |
package bagus2x.sosmed.presentation.common.components | |
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.layout.PaddingValues | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.size | |
import androidx.compose.foundation.layout.wrapContentSize | |
import androidx.compose.foundation.pager.VerticalPager | |
import androidx.compose.foundation.pager.rememberPagerState | |
import androidx.compose.material.MaterialTheme |
class ExoPlayerState( | |
context: Context, | |
private val scope: CoroutineScope | |
) : ExoPlayer by ExoPlayer.Builder(context).build(), Player.Listener { | |
@get:JvmName("playing") | |
var isPlaying by mutableStateOf(false) | |
private set | |
var duration by mutableStateOf(0.seconds) | |
private set | |
var currentPosition by mutableStateOf(0.seconds) |
@Composable | |
fun NotificationScreen( | |
navController: NavController, | |
viewModel: NotificationViewModel = hiltViewModel() | |
) { | |
val videos by viewModel.videos.collectAsStateWithLifecycle() | |
val listState = rememberLazyListState() | |
BoxWithConstraints { | |
val density = LocalDensity.current |
fun CommentListScreen() { | |
val comments by produceDummyComments(10000) | |
Box { | |
LazyColumn( | |
modifier = Modifier | |
.systemBarsPadding() | |
.fillMaxSize(), | |
) { | |
commentList(comments) | |
} |
create or replace function create_path(parent_id_param bigint) returns ltree | |
language plpgsql | |
as | |
$$ | |
declare parent_path ltree; | |
declare current_id BIGINT; | |
BEGIN | |
SELECT currval('"comment_id_seq"') into current_id; | |
IF parent_id_param is NOT NULL THEN |
@Composable | |
fun RatingBar( | |
rating: Float, | |
onChange: (Int, Float) -> Unit, | |
max: Int | |
) { | |
Row { | |
val value = rating * max | |
val fullStar = value.toInt() | |
var fractionStar = value - fullStar |
private val DaysInMonthCell = GridCells.Fixed(count = 7) | |
@Composable | |
fun Calendar( | |
modifier: Modifier = Modifier, | |
localDateTime: LocalDateTime | |
) { | |
val firstDate = remember(localDateTime) { | |
with(localDateTime) { | |
val firstOfMonth = withDayOfMonth(1) |