Skip to content

Instantly share code, notes, and snippets.

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

Arafat Husayn arafathusayn

👨‍💻
Focusing
View GitHub Profile
let promises = []
promises[0] = new Promise((resolve, reject) => {
setTimeout(() => {
console.log("first promise")
reject("first promise")
}, 1000)
})
promises[1] = new Promise((resolve, reject) => {
@arafathusayn
arafathusayn / flattenObject.js
Created September 12, 2018 00:33
A non-recursive JavaScript function to flatten Object i.e. list all deeply nested properties at the same level
function flattenObject(object, options) {
let result = {};
let walked = [];
let stack = [
{
object: object,
stack: ""
}
];
@arafathusayn
arafathusayn / ter.js
Created September 11, 2018 07:14
Automated TER Submission
const elements = document.querySelectorAll(`#cleContent > form > table:nth-child(2) td input[type=radio]`)
for (const el of elements) {
if (el.value === '5') {
el.checked = true
}
}
document
.querySelector(`#cleContent > form > table:nth-child(2) > tbody > tr:nth-child(21) > td > input:nth-child(1)`)
@arafathusayn
arafathusayn / bashrc_append_gitbranch.sh
Created September 1, 2018 10:07
Git Branch in Bash Prompt
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\n\$ '
else
PS1='\n${debian_chroot:+($debian_chroot)}\u@\h:\w $(parse_git_branch)\n\$ '
@arafathusayn
arafathusayn / hidetidio.js
Last active May 7, 2024 23:42
Hide TidioChat Branding (for new theme)
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 / clear_cache.sh
Created May 6, 2018 15:41
Laravel - clear all cache from CLI
#!/bin/bash
php artisan optimize
php artisan cache:clear
php artisan route:cache
php artisan view:clear

Keybase proof

I hereby claim:

  • I am arafathusayn on github.
  • I am arafat (https://keybase.io/arafat) on keybase.
  • I have a public key ASCAl2rgSBku1FZa9xPD203tD417_uspLVH5e5_Sdg3fQgo

To claim this, I am signing this object:

@arafathusayn
arafathusayn / vscode_git_fix_cmd.bat
Created February 8, 2018 08:32
Fix VS Code git push issue on Windows OS with a double-click
@echo on
cd /d %~dp0
start-ssh-agent /k "code ."
@arafathusayn
arafathusayn / git_add_commit_push.bat
Created February 8, 2018 08:26
Urgent git add all, commit with a random number and push with a single command on Windows OS
@echo on
git pull
set /a num=%random% %%1000 +1
git add . && git commit -m %num%
git push
@arafathusayn
arafathusayn / xampp_php7_xdebug.md
Created February 1, 2018 12:57 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP

Installing Xdebug for XAMPP with PHP 7.x

Requirements

Setup