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 / 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
@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 / 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 / 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 / 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: ""
}
];
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 / device-names-installs.js
Created January 14, 2019 12:36
From Google Play Console, this script will get the name list of the active device models and the number of installs for each in JSON format in clipboard
/*
* Instructions:
* Go to "Google Play Console" > "Statistics" > click on the dropdown beside "Select" and choose "Device" ...
* Then click "Add Device" and you can read the list of active devices and the number of installs ...
* After that, run the script in the browser console and you'll see a table after a while and the JSON data will be copied.
*/
const spans = document.querySelectorAll('[aria-label*="device :"]')
const data = []
let skipFirstOne = true
@arafathusayn
arafathusayn / pdf_to_png.js
Created February 13, 2019 10:01
PDF to PNG
(function() {
function main() {
var pages = [], heights = [], width = 0, height = 0, currentPage = 1;
var scale = 1.5;
function draw() {
var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d');
canvas.width = width;
canvas.height = height;
@arafathusayn
arafathusayn / WebGL-frameworks-libraries.md
Created February 24, 2019 14:16 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL frameworks and libraries

A non-exhaustive list of WebGL frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • stack.gl: an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • AwayJS: AwayJS is a graphics library for javascript written in typescript
  • SceneJS: An extensible WebGL-based engine for high-detail 3D visualisation
@arafathusayn
arafathusayn / noscript-tracking.go
Created May 28, 2019 09:01 — forked from wybiral/noscript-tracking.go
Tracking cursor position in real-time with remote monitoring (without JavaScript)
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)