Skip to content

Instantly share code, notes, and snippets.

@Gustavo-Kuze
Gustavo-Kuze / force-ctrl-c-v.md
Last active May 16, 2024 15:55
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);
})(); 
@kantenkugel
kantenkugel / FixedSizeCache.java
Last active May 6, 2024 12:17
Java Cache with Map/List and maximum size
import java.util.HashMap;
import java.util.Map;
public class FixedSizeCache<K, V> {
private final Map<K, V> map = new HashMap<>();
private final K[] keys;
private int currIndex = 0;
public FixedSizeCache(int size) {
if(size < 1)