Skip to content

Instantly share code, notes, and snippets.

View luthfipun's full-sized avatar
😈
Focusing

Luthfi Abdul Azis luthfipun

😈
Focusing
View GitHub Profile
@rubenquadros
rubenquadros / CustomExoPlayerControls.kt
Last active February 13, 2024 14:03
Custom ExoPlayer controls overlay
@Composable
private fun VideoPlayer(modifier: Modifier = Modifier) {
val context = LocalContext.current
val exoPlayer = remember {
ExoPlayer.Builder(context)
.apply {
setSeekBackIncrementMs(PLAYER_SEEK_BACK_INCREMENT)
setSeekForwardIncrementMs(PLAYER_SEEK_FORWARD_INCREMENT)
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
@stevdza-san
stevdza-san / LoadingAnimation.kt
Last active March 19, 2024 16:41
Loading Animation with Jetpack Compose
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkCapabilities
import android.net.NetworkRequest
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
@graymind75
graymind75 / NetworkHelper.kt
Last active August 23, 2022 18:26
a singleton class to check the network connection state, use both of the NetworkCallback and ConnectivityManager to support older devices
package com.graymind75
import android.content.Context
import android.net.*
import android.os.Build
import androidx.annotation.RequiresApi
/**
* singleton class to check the network connection state
* It's use the old ConnectivityManager.activeNetworkInfo way for pre LOLLIPOP
@ahmadshobirin
ahmadshobirin / set locale and timezone indonesia in laravel.md
Last active May 19, 2024 15:10
set locale and timezone indonesia in laravel

Open File App\Providers\AppServiceProvider

Change method boot

use Carbon\Carbon;


public function boot()
{
	config(['app.locale' => 'id']);
@julesjans
julesjans / screen-gif.sh
Last active May 8, 2021 16:40
Capture iOS Simulator to animated gif
# Turn on the simulator screen capture
xcrun simctl io booted recordVideo ~/simulator.mov
# Convert the iPhone 6s screen shot into a gif:
ffmpeg -i ~/simulator.mov -vf scale=320:-1 -r 6 -f gif -y simulator.gif
@renatoargh
renatoargh / Restarting Your Node.js App at Reboot with Crontab.md
Last active February 20, 2024 12:03
Restarting Your Node.js App at Reboot with Crontab

Restarting Your Node.js App at Reboot

Cronjob can prevent your application and your users from unexpected downtimes.

Create a file called starter.sh in your application's home folder and copy the following code:

#!/bin/sh

if [ $(ps -e -o uid,cmd | grep $UID | grep node | grep -v grep | wc -l | tr -s "\n") -eq 0 ]