Skip to content

Instantly share code, notes, and snippets.

View Bloody-Badboy's full-sized avatar
😪
Wake me up when we can travel again

Arpan Sarkar Bloody-Badboy

😪
Wake me up when we can travel again
View GitHub Profile
@Bloody-Badboy
Bloody-Badboy / MultipleChoiceListAdapter.kt
Created October 13, 2020 05:21
RecycleView Single Choice & Multiple Choice Adapter
package dev.arpan
import android.util.SparseBooleanArray
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckedTextView
import androidx.recyclerview.widget.RecyclerView
import dev.arpan.ecommerce.R
@Bloody-Badboy
Bloody-Badboy / gist:5bc5f65bd86c312a1506a8f664ff62fd
Created September 21, 2020 13:56 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
class FragmentViewBindingProperty<T : ViewBinding>(
private val viewBinder: ViewBinder<T>
) : ReadOnlyProperty<Fragment, T> {
private var viewBinding: T? = null
private val lifecycleObserver = BindingLifecycleObserver()
@MainThread
override fun getValue(thisRef: Fragment, property: KProperty<*>): T {
checkIsMainThread()
@Bloody-Badboy
Bloody-Badboy / WindowInsetsExtensions.kt
Last active July 9, 2022 21:13
SystemWindowInsets Extensions + Binding Adapters
package dev.arpan.utils
import android.view.View
import android.view.ViewGroup
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
// Make the content ViewGroup ignore insets so that it does not use the default padding
@BindingAdapter("ignoreInsets")
fun View.ignoreInsets(
@Bloody-Badboy
Bloody-Badboy / name_my_color.json
Last active July 22, 2020 19:38
Name that color json
[{"name":"Black","hex":"#000000","group":"Black"},
{"name":"Air Force Blue","hex":"#5D8AA8","group":"Blue"},
{"name":"Alice Blue","hex":"#F0F8FF","group":"Blue"},
{"name":"Allports","hex":"#1F6A7D","group":"Blue"},
{"name":"Anakiwa","hex":"#8CCEEA","group":"Blue"},
{"name":"Aqua","hex":"#00FFFF","group":"Blue"},
{"name":"Aquamarine","hex":"#7FFFD4","group":"Blue"},
{"name":"Arapawa","hex":"#274A5D","group":"Blue"},
{"name":"Astral","hex":"#376F89","group":"Blue"},
{"name":"Astronaut","hex":"#445172","group":"Blue"},
import androidx.lifecycle.Observer
/**
* Used as a wrapper for data that is exposed via a LiveData that represents an event.
*/
open class Event<out T>(private val content: T) {
var hasBeenHandled = false
private set // Allow external read but not write
@Bloody-Badboy
Bloody-Badboy / InOut.kt
Created April 30, 2020 16:46
Kotlin IN OUT
package dev.arpan.recycleview.drills.utils
/**
* **** OUT ****
* Let's say that we want to create a producer class that will be producing a result of some type T.
* Sometimes; we want to assign that produced value to a reference that is of a supertype of the type T.
* To achieve that using Kotlin, we need to use the out keyword on the generic type. It means that we
* can assign this reference to any of its supertypes.
* The out value can be only be produced by the given class but not consumed:
*
@Bloody-Badboy
Bloody-Badboy / RingOfCirclesView.kt
Created March 4, 2019 05:18 — forked from alexjlockwood/RingOfCirclesView.kt
Kotlin implementation of a Ring of Circles animation, inspired by https://twitter.com/InfinityLoopGIF/status/1101584983259533312
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
private const val N = 16
private const val PERIOD1 = -10000.0
private const val PERIOD2 = -500.0
@Bloody-Badboy
Bloody-Badboy / LinkedList.cpp
Last active March 7, 2019 18:00
Simple singly linked list implementation in C++
#include <iostream>
using namespace std;
template<class T>
class Node {
public:
T value;
Node<T> *next;

To remove OpenJDK (the one you've already installed)

sudo apt-get purge openjdk-\*

Make a new directory for your new JDK

sudo mkdir -p /usr/local/java

Copy the file to the directory (you should be in that file path)

sudo cp -r jdk-XuXX-linux-x64.tar.gz /usr/local/java/

Extract the file