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 / 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 / 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 / takeScreenShot.md
Created December 5, 2019 08:54
Useful Screenshot shortcut from dev tools

DevTools screenshot functionality

When using Chrome developer tools, it can be useful to capture a screenshot of the entire page. And while there are add-ons to achieve this, google chrome has it’s own functionality built in.

Steps

Open Chrome Devtools
in Devtools Ctrl+P (Cmd+P on Mac)
Start typing >screenshot
Choose from the available functions (capture full size screenshot has been by far my most useful)

Enjoy your new screenshot

@g-rohit
g-rohit / download-mp3-svn.js
Created December 9, 2019 18:44
add a download btn to svn
var nowPlaying = document.getElementById('now-playing');
if (nowPlaying) {
var meta = nowPlaying.getElementsByClassName('meta-wrap')[0];
var a = document.createElement('a');
a.setAttribute('id', 'download-song');
a.setAttribute('class', 'btn x-small green');
a.style.display = 'inline';
a.textContent = 'Download Song';
meta.appendChild(a);
@g-rohit
g-rohit / fetchTweets.js
Created December 13, 2019 07:46
Fetch and export tweets into a html file
const fs = require("fs");
const $ = require("cheerio");
const rp = require("request-promise");
var url = "https://twitter.com/india";
const fileName = "tweets-file-" + url.substr(20) + ".html";
const tweets = fs.createWriteStream(fileName);
// write headers
tweets.write(`Tweets:
<style>
@g-rohit
g-rohit / sticky-footer.css
Created December 13, 2019 10:03
sticky footer
@g-rohit
g-rohit / remove-git-sub-module.md
Created December 27, 2019 19:07
remove git sub module or grayed out folder

This is the solution:

git rm --cached (folderNameHere)

@g-rohit
g-rohit / OpenDirectories on Google.md
Created January 13, 2020 04:55
Manually Searching OpenDirectories on Google

For videos/movies/tvshows :

intext:"Search Term" intitle:"index.of" +(wmv|mpg|avi|mp4|mkv|mov) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml)

For Images :

intext:"Search Term" intitle:"index.of./" (bmp|gif|jpg|png|psd|tif|tiff) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml)

For Music:

intext:"Search Term" intitle:"index.of./" (ac3|flac|m4a|mp3|ogg|wav|wma) -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml)

@g-rohit
g-rohit / wget.md
Created January 13, 2020 09:38
wget commands

wget -r -np -k --user-agent="_" "URL Here"

@g-rohit
g-rohit / youtube-dl.md
Last active December 9, 2020 09:56
best video + audio format in Youtube-dl

youtube-dl -f 299+140 "url"