Skip to content

Instantly share code, notes, and snippets.

View arafathusayn's full-sized avatar
👨‍💻
Focusing

Arafat Husayn arafathusayn

👨‍💻
Focusing
View GitHub Profile
@arafathusayn
arafathusayn / nodejs_ajax_csrf_protection.js
Created January 21, 2017 08:22
A note for NodeJS & Ajax against Cross-site Request Forgery (CSRF) using EJS & jQuery
var csrf_token = '<%= token_value %>'; // Between <%= %> is the EJS object property passed from server.
$("body").bind("ajaxSend", function (elm, xhr, s) {
if (s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Token', csrf_token);
}
});
@arafathusayn
arafathusayn / facebook-no-like-react-share-notification.css
Last active March 2, 2017 14:58
CSS for Facebook - Hide Like, React & Share Notification! It can be used with browser extension like "Stylish" or "FreeStyler" on Google Chrome, Mozilla Firefox, Opera etc. Features: It can hide the pop-up notifications and also works on Android and iOS platform if you browse the touch version of Facebook with Mozilla Firefox.
@-moz-document domain("facebook.com") {
li[data-gt*="story_reshare"], li[data-gt*="like"], li[data-gt*="feedback_reaction"], A._33e._1_0e[href*="notif_t=feedback_reaction_generic"], A._33e._1_0e[href*="notif_t=story_reshare"], A._33e._1_0e[href*="notif_t=like"] {
display: none !important;
}
A.touchable[href*="notif_t=feedback_reaction_generic"], A.touchable[href*="notif_t=story_reshare"], A.touchable[href*="notif_t=like"] {
display: none !important;
}
}
/*
# Install:
@arafathusayn
arafathusayn / news-feed-image-blur.css
Last active March 10, 2017 12:39
Facebook Image Blur and Clear on Hover in News Feed
/*
# Install from the link:
https://userstyles.org/styles/139786/facebook-photo-blur-in-news-feed
*/
@-moz-document domain("www.facebook.com"), domain("web.facebook.com") {
div[id*="feed_stream"] a[target="_blank"] img,
div[id*="feed_stream"] a[href*="photo"] img,
@arafathusayn
arafathusayn / youtube-thumb-blur.css
Created March 8, 2017 09:06
Blur Youtube Thumbnails and Account Avatars
/*
Install from here: https://userstyles.org/styles/139876/youtube-thumbnails-blur-and-unblur
*/
@-moz-document domain("www.youtube.com") {
div[class*="thumb"] img {
filter: blur(5px);
-webkit-filter: blur(5px);
@arafathusayn
arafathusayn / twitter-blur.css
Last active March 10, 2017 16:39
Twitter Blur Image, GIF and Video
/*
INSTALL from this Link:
https://userstyles.org/styles/139978/twitter-blur-vision
Or, you can also use the CSS code below with GreeseMonkey or FreeStyler
*/
@-moz-document domain("twitter.com"), domain("support.twitter.com") {
.ProfileTimeline a[class*="action-profile"][class*="user-profile"] img,
@arafathusayn
arafathusayn / hidetdo.js
Last active February 21, 2021 08:47
Hide Tidio Chat Branding (Old Theme). For new theme, check: https://gist.github.com/arafathusayn/663217f383b02017d20be6ba465959d4
function hideTdo() {
var timer = null;
var target = document.querySelector('#tidio-chat iframe');
if(!target) {
if(timer !== null) {
clearTimeout(timer);
}
timer = setTimeout(hideTdo, 500);
return;
} else {
@arafathusayn
arafathusayn / tmux_local_install.sh
Last active April 21, 2017 11:57 — forked from crobicha/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Don't forget: chmod +x tmux_local_install.sh
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
@arafathusayn
arafathusayn / index.js
Last active May 4, 2017 06:21 — forked from schnerd/index.js
index.js
const CDP = require('chrome-remote-interface');
const argv = require('minimist')(process.argv.slice(2));
const file = require('fs');
// CLI Args
const url = argv.url || 'https://www.google.com';
const format = (argv.format === 'jpeg') ? 'jpeg' : (argv.format === 'jpg') ? 'jpg' : 'png';
const viewportWidth = argv.viewportWidth || 1920;
const viewportHeight = argv.viewportHeight || 1080;
const aspectRatio = viewportWidth / viewportHeight;
@arafathusayn
arafathusayn / acceptAllFriendRequestsOnFB.js
Created July 30, 2017 12:15
When you got so many friend requests on Facebook but you don't like to click on "Confirm" button of each request!
setInterval(() => { document.querySelector('div#FriendRequestMorePager > div > a').click() }, 5000)
setInterval(() => {
document.querySelector('button[class="_42ft _4jy0 _4jy3 _4jy1 selected _51sy"][value="1"][type="submit"]').scrollIntoView()
window.scrollBy(0, -100)
document.querySelector('button[class="_42ft _4jy0 _4jy3 _4jy1 selected _51sy"][value="1"][type="submit"]').click()
}, 1000)
@arafathusayn
arafathusayn / chrome-bg-with-sw-communication.md
Created September 3, 2017 13:23 — forked from zdila/chrome-bg-with-sw-communication.md
How to send messages from service worker to the chrome extension without having the webapp open

In the background script we have:

chrome.webRequest.onBeforeRequest.addListener(function (details) {
  if (details.method === 'HEAD') {
    if (details.url.endsWith('?start')) {
      ringSound.play();
    } else if (details.url.endsWith('?stop')) {
      ringSound.pause();
 ringSound.currentTime = 0;