Skip to content

Instantly share code, notes, and snippets.

@aubryll
aubryll / ListAdapterWithHeader.java
Created November 24, 2019 21:02
This is the Java version of NickHolcombe's ListAdapterWithHeader which was originally wrote in Kotlin, after spending countless hours online looking for a way to add a header to my PagedListAdapter I finally found a solution https://gist.github.com/NickHolcombe/0e1c27892d6b73271f10e12268f40187 except it was in Kotlin, I managed to rewrite it in …
import androidx.recyclerview.widget.AsyncDifferConfig;
import androidx.recyclerview.widget.AsyncListDiffer;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListUpdateCallback;
import androidx.recyclerview.widget.RecyclerView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import kotlin.jvm.internal.Intrinsics;
@matthewsuan
matthewsuan / axios.js
Last active March 28, 2024 12:36
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@pantsel
pantsel / docker-compose.yml
Last active October 10, 2024 12:50
example docker-compose.yml for kong, postgres and konga
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
@NickHolcombe
NickHolcombe / ListAdapterWithHeader.kt
Last active October 18, 2023 00:16
Example of a RecyclerView Adapter based on ListAdapter with a header
package example
import android.support.v7.recyclerview.extensions.AsyncDifferConfig
import android.support.v7.recyclerview.extensions.AsyncListDiffer
import android.support.v7.util.DiffUtil
import android.support.v7.util.ListUpdateCallback
import android.support.v7.widget.RecyclerView
/**
* {@link RecyclerView.Adapter RecyclerView.Adapter} base class based on
@aluanhaddad
aluanhaddad / Example.cs
Created November 22, 2017 23:31
C# Observable HTTP
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Immutable;
using System.Linq;
using System.Net.Http;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Joins;
using System.Reactive.Linq;