Skip to content

Instantly share code, notes, and snippets.

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

Moch Naufal Nibros naufalnibros

:octocat:
Working from home
View GitHub Profile
@ptenteromano
ptenteromano / photos.tsx
Last active September 14, 2024 09:27
Infinite Scroll with Remix Run
/*
* Infinite Scroll using Remix Run
* Based on client-side Scroll position
* Full Article here: https://dev.to/ptenteromano/infinite-scroll-with-remix-run-1g7
*/
import { useEffect, useState, useCallback } from "react";
import { LoaderFunction, useLoaderData, useFetcher } from "remix";
import { fetchPhotos } from "~/utils/api/restful";
import type { PhotoHash } from "~/utils/api/types";
@varunon9
varunon9 / AlwaysRunningAndroidService.md
Last active October 29, 2025 03:12
How to create an always running service in Android

Full Source Code: https://github.com/varunon9/DynamicWallpaper/tree/always_running_service

Steps-

  1. Create a Foreground Service (MyService.java)
  2. Create a Manifest registered Broadcast Receiver (MyReceiver.java) which will start your Foreground Service
  3. In onDestroy lifecycle of MyService, send a broadcast intent to MyReceiver
  4. Launch the MyService on app start from MainActivity (see step 8)
  5. With above 4 steps, MyService will always get re-started when killed as long as onDestroy of Service gets called
  6. onDestroy method of Service is not always guaranteed to be called and hence it might not get started again
<?php
class Menu{
private static array $mainMenuContentInstance = [] ;
private static string $currentMenuIndex='';
public static function make( string $index , array $defaultIndex=[] )
{
self::$mainMenuContentInstance[$index]=[
'defaultIndex'=>$defaultIndex,
@weverb2
weverb2 / FormValidationActivity.kt
Last active March 19, 2023 01:30
Data Binding + LIve Data Form Validation
import android.os.Bundle
import android.util.Log
import android.util.Patterns
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProviders
import works.wever.mvvm.R
@Warchant
Warchant / sonarqube-docker-compose.yml
Last active June 30, 2025 15:13
docker-compose file to setup production-ready sonarqube
version: "3"
services:
sonarqube:
image: sonarqube
expose:
- 9000
ports:
- "127.0.0.1:9000:9000"
networks:
@codediodeio
codediodeio / database.rules.json
Last active February 18, 2026 11:11
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@Macrow
Macrow / gist:99e2be7208dd42d76c0be8556dc785b0
Created May 24, 2017 17:00
Android, RxJava and Retrofit: Wait for multiple network calls to finish
[url]https://newfivefour.com/android-rxjava-wait-for-network-calls-finish.html[/url]
Android, RxJava and Retrofit: Wait for multiple network calls to finish
Say you have multiple network calls you need to make–cals to get Github user information and Github user events for example.
And you want to wait for each to return before updating the UI. RxJava can help you here.
Let’s first define our Retrofit object to access Github’s API, then setup two observables for the two network requests above:
@riyazMuhammad
riyazMuhammad / CustomItemClickListener.java
Last active December 30, 2020 15:10
Easy Implementation of RecyclerView custom onItemClickListener
public interface CustomItemClickListener {
public void onItemClick(View v, int position);
}