Skip to content

Instantly share code, notes, and snippets.

View g-rohit's full-sized avatar
🎯
Focusing

G Rohit g-rohit

🎯
Focusing
View GitHub Profile
@g-rohit
g-rohit / json-vs-jsonp.js
Last active November 20, 2019 18:56
JSON vs JSONP
JSONP is really a simple trick to overcome the XMLHttpRequest same domain policy. (As you know one cannot send AJAX (XMLHttpRequest) request to a different domain.)
So - instead of using XMLHttpRequest we have to use script HTML tags, the ones you usually use to load js files, in order for js to get data from another domain. Sounds weird?
Thing is - turns out script tags can be used in a fashion similar to XMLHttpRequest! Check this out:
script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://www.someWebApiServer.com/some-data';
You will end up with a script segment that looks like this after it loads the data:
@g-rohit
g-rohit / main.js
Created November 18, 2019 05:38
instagram-all-images-hd
javascript:[...document.querySelectorAll('img,video,source')].map(e=>e.src&&(e.tagName!='IMG'||e.srcset.includes('1080w'))&&this.open(e.src,''))
@g-rohit
g-rohit / fa-pro.css
Last active November 20, 2019 21:34
fa-pro.css
/*!
* Font Awesome Pro 5.3.1 by @fontawesome - https://fontawesome.com*/
.fa,.fab,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margi
@g-rohit
g-rohit / desginemode.txt
Last active September 28, 2019 14:33
designmode on chrome
//document.querySelectorAll('*').forEach(e => e.contentEditable = 'true');
document.designMode = 'on'
@g-rohit
g-rohit / Remove-controls.js
Created August 8, 2019 19:57
Remove all control elements from Youtube video
// Paste this below code into the console on the youtube:
javascript:(function(){var goaway=".ytp-chrome-top,.ytp-chrome-bottom{display:none;}";if("\v"=="v"){document.createStyleSheet().cssText=goaway}else{var tag=document.createElement("style");tag.type="text/css";document.getElementsByTagName("head")[0].appendChild(tag);tag[(typeof document.body.style.WebkitAppearance=="string")?"innerText":"innerHTML"]=goaway}})();
//then you can take a full screen screenshot ;)
@g-rohit
g-rohit / Hidden-pre-header-SSL.html
Created August 6, 2019 21:52
HTML email hidden - Preheader or SSL
<!-- Put this right after the opening tag of body -->
<div style="display:none; font-size:0px; color:#ffffff; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden;">
{{Your preheder here}}
&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&#160;&zwnj;&
@g-rohit
g-rohit / Change nav bar color on scroll.html
Created July 24, 2019 19:16
Change nav bar color on scroll
<!DOCTYPE html>
<!--[if lte IE 6]><html class="preIE7 preIE8 preIE9"><![endif]-->
<!--[if IE 7]><html class="preIE8 preIE9"><![endif]-->
<!--[if IE 8]><html class="preIE9"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>title</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=font1|font2|etc" type="text/css">
@g-rohit
g-rohit / random-alphabet-letter.js
Last active July 14, 2019 00:20
Print random alphabet letters / words
var alphabet = "abcdefghijklmnopqrstuvwxyz";
console.log(alphabet[Math.floor(Math.random() * alphabet.length)]);
// Priting random 6 letters word
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var random = "";
for (i = 0;i < 6 ; i ++) {
random = random + alphabet[Math.floor(Math.random() * alphabet.length)];
@g-rohit
g-rohit / regex-pw.txt
Created June 30, 2019 18:38
Reg ex for password
You may use this regex with multiple lookahead assertions (conditions):
^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$
This regex will enforce these rules:
At least one upper case English letter, (?=.*?[A-Z])
At least one lower case English letter, (?=.*?[a-z])
At least one digit, (?=.*?[0-9])
At least one special character, (?=.*?[#?!@$%^&*-])
Minimum eight in length .{8,} (with the anchors)
@g-rohit
g-rohit / html-sign.html
Created June 29, 2019 19:27
Html email signature
<html><head></head><body><table class="sc-jAaTju fNCBho" cellpadding="0" cellspacing="0" style="vertical-align: -webkit-baseline-middle; font-size: medium; font-family: 'Trebuchet MS';">
<tbody>
<tr>
<td>
<table class="sc-jAaTju fNCBho" cellpadding="0" cellspacing="0" style="vertical-align: -webkit-baseline-middle; font-size: medium; font-family: 'Trebuchet MS'; width: 100%;">
<tbody>
<tr>
<td height="30"></td>
</tr>