Skip to content

Instantly share code, notes, and snippets.

View ShivrajRath's full-sized avatar

Shivraj Rath ShivrajRath

View GitHub Profile
javascript:(function()%7Bconst%20%24html%20%3D%20document.querySelector(%22html%22)%3Bconst%20%24body%20%3D%20document.querySelector(%22body%22)%3B%24html.style.overflowY%20%3D%20%22scroll%22%3B%24html.style.overflow%20%3D%20%22scroll%22%3B%24body.style.overflowY%20%3D%20%22scroll%22%3B%24body.style.overflow%20%3D%20%22scroll%22%3Bdocument.querySelectorAll(%22*%22).forEach((el)%20%3D%3E%20%7Bconst%20cs%20%3D%20getComputedStyle(el)%3Bconst%20elPos%20%3D%20cs.position%3Bconst%20filter%20%3D%20cs.filter%3Bif%20(%5B%22fixed%22%2C%20%22sticky%22%5D.includes(elPos))%20%7Bel.parentNode.removeChild(el)%3B%7Dif%20(filter%20%26%26%20filter.match(%2Fblur%2F))%20%7Bel.style.setProperty(%22filter%22%2C%20%22none%22)%3B%7D%7D)%7D)()
@ShivrajRath
ShivrajRath / clean-twitter.js
Created October 14, 2021 21:46
Clean Twitter (Removes Promoted Ads and distractions)
const removeEl = (el, query) => {
if (el) {
if (query) {
el[query].remove();
} else {
el.remove();
}
}
};
removeEl(document.querySelector("header"));
@ShivrajRath
ShivrajRath / Basic HTM5 Boilerplate
Last active December 2, 2020 10:05
Basic HTML5 Boilerplate
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="favicon.png">
@ShivrajRath
ShivrajRath / arrayIterator.js
Created January 14, 2015 20:10
Array Iterator in Javascript
/*************************************************************
* Adds iterator to javascript Arrays
*************************************************************/
/**
* Returns previous element in the iteration
* @return {[object]} [Returns null if iteration has not started or if limit has reached]
*/
Array.prototype.prev = function(){
if(isNaN(this.index) || this.index <=0){
@ShivrajRath
ShivrajRath / css-reset.css
Created July 26, 2019 15:52
Minimal CSS Reset
html {
box-sizing: border-box;
font-size: 16px;
}
*, *:before, *:after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
@ShivrajRath
ShivrajRath / algoAssert.js
Last active June 18, 2019 04:06
Code to run quick assertion on your function algorithms
const equalityCheck = function(input1, input2) {
if (typeof input1 !== typeof input2) {
return false;
}
if (input1 === input2) {
return true;
}
if (Array.isArray(input1) && Array.isArray(input2)) {
return input1.reduce((acc, el, index) => acc && el === input2[index], true);
}
@ShivrajRath
ShivrajRath / box-model.less
Created May 22, 2017 22:47
Generates a utility of padding, margins, width and font sizes
/ ............................................................
// .for
.for(@i, @n) {.-each(@i)}
.for(@n) when (isnumber(@n)) {.for(1, @n)}
.for(@i, @n) when not (@i = @n) {
.for((@i + (@n - @i) / abs(@n - @i)), @n);
}
// ............................................................
@ShivrajRath
ShivrajRath / fullscreen-blur-background-image.css
Last active April 9, 2017 17:47
Full screen blurred background in CSS
.cls{
position: fixed;
top: 0;
right: 0;
bottom: 0;
background-image: url("home.jpg");
min-width: 100%;
min-height: 100%;
-webkit-filter: blur(18px);
-o-filter: blur(18px);
!function (window) {"use strict";
// by WebReflection - WTFPL License
var
prefixes = "r webkitR mozR msR oR".split(" "),
process = "process",
nextTick = "nextTick",
i = 0,
p = window[process] || (window[process] = {})
;
while (!p[nextTick] && i < prefixes.length)
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/