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 / Log.java
Created December 21, 2018 16:15
Logging utility for java
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by bloodybadboycreation on 17/9/17.
*/

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

@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;
@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 / 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:
*
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 / 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"},
@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(
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 / 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: