Skip to content

Instantly share code, notes, and snippets.

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

nikhi1 nikhil-thakkar

🎯
Focusing
View GitHub Profile
@pyricau
pyricau / WindowSpy.kt
Last active September 15, 2020 20:34
import android.annotation.TargetApi
import android.os.Build.VERSION_CODES
import android.view.View
import android.view.Window
object WindowSpy {
/**
* Installs a listener for new [Window] instances. This should only be called once, any new call
* will uninstall the previous listener.

Introducing Desktop Class Browsing on iPad

  • What does desktop class mean?
    • Getting more done in Safari
    • New download manager
      • Download and upload files in the background while working on other tabs or other apps
    • Full-page zoom, hiding toolbar, per-site preferences
    • All the keyboard shortcuts you expect from a desktop browser
    • At the heart of it all is browsing desktop websites
  • Apple has been working on Web browsers for a long time
@Gustavo-Kuze
Gustavo-Kuze / force-ctrl-c-v.md
Last active November 16, 2024 16:01
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);
})(); 
@mzgreen
mzgreen / SizeHelper.kt
Last active February 13, 2021 15:23
A ConstraintHelper implementation that has additional layout params: screenHeight_percent and screenWidth_percent which allow to make referenced views height and width to be equal to screenHeight(or screenWidth)*some_percent_value. Where some_percent_value is a value between 0.0 and 1.0.
class SizeHelper @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintHelper(context, attrs, defStyleAttr) {
private val screenHeight: Int = resources.displayMetrics.heightPixels
private val screenWidth: Int = resources.displayMetrics.widthPixels
private var layoutConstraintScreenHeightPercent = UNSPECIFIED_CONSTRAINT_SCREEN_PERCENT