Skip to content

Instantly share code, notes, and snippets.

View nikhil-thakkar's full-sized avatar
🎯
Focusing

nikhi1 nikhil-thakkar

🎯
Focusing
View GitHub Profile
@nikhil-thakkar
nikhil-thakkar / force-ctrl-c-v.md
Created July 12, 2022 17:23 — forked from Gustavo-Kuze/force-ctrl-c-v.md
Enable copy and paste in a webpage from the browser console
javascript:(function(){
  allowCopyAndPaste = function(e){
  e.stopImmediatePropagation();
  return true;
  };
  document.addEventListener('copy', allowCopyAndPaste, true);
  document.addEventListener('paste', allowCopyAndPaste, true);
  document.addEventListener('onpaste', allowCopyAndPaste, true);
})(); 
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.StartFragment">
<!--If somehow this could walk through its children and collect their ids to make a logical grouping
without adding the ref ids like we do with Group and delegate to parent ConstraintLayout for
drawing the children
-->
<androidx.constraintlayout.widget.LogicalGroup
@nikhil-thakkar
nikhil-thakkar / SampleActivity.kt
Last active March 28, 2023 08:25
Generic databinding adapter for items in Recyclerview
import androidx.recyclerview.widget.RecyclerView
class SampleActivity: Activity(), OnItemActionListener {
private val adapter by lazy { ViewTypeAdapter<ViewType<*>>(list = list, onItemActionListener = this) }
//Prepare the list somehow, whether in ViewModel or presenter and then set it to adapter using setList
private val list: List<ViewType<*>> by lazy {
arrayListOf<>(HeaderViewType("Header"),
RowViewType("content"),
#import <UIKit/UIKit.h>
@interface CustomNavigationController : UINavigationController<UINavigationControllerDelegate>
@end