Skip to content

Instantly share code, notes, and snippets.

View mudassaralichouhan's full-sized avatar
:octocat:
It’s not a bug; it’s an undocumented feature.

Mudassar Ali mudassaralichouhan

:octocat:
It’s not a bug; it’s an undocumented feature.
View GitHub Profile
@mudassaralichouhan
mudassaralichouhan / WebSocket.php
Last active January 31, 2023 11:46
web socket example
<?php
class WebSocket
{
private array $clients = [];
private $server;
private int $sleep = 0;
@mudassaralichouhan
mudassaralichouhan / select.js
Created February 1, 2023 08:55
multi select get values
let checked = document.querySelectorAll('form#group-store select[name="employees[]"] :checked');
checked = [...checked].map(option => option.value)
(http|ftp|https|ws|wss):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])
const slugInput = document.querySelector('form input[name="slug"]');
const slugText = slugInput.value;
var slugInputIsEdit = false;
slugInput.onchange = (e) => {
slugInputIsEdit = true;
}
document.querySelector('form input[name="name"]').onkeyup = (e) => {
@mudassaralichouhan
mudassaralichouhan / demo.sh
Created June 25, 2023 10:06
import *.sql file form terminal
mysql -u root -p laravel_and_vite < /home/darkside/Downloads/world.sql
@mudassaralichouhan
mudassaralichouhan / mySqrt.cpp
Last active July 22, 2023 19:46
SquareRoot Here is a very awesome code to find sqrt and even faster than original sqrt function.
#include "iostream"
#define EPSILON 0.0000001 // least minimum value for comparison
using namespace std;
class Solution {
public:
int mySqrt(double x) {
if (x <= 0)
return 0;
# Set default permissions for directories
find /home/me -type d -exec chmod 755 {} \;
# Set default permissions for files
find /home/me -type f -exec chmod 644 {} \;
docker run --rm -v $(pwd):/app -w /app php php artisan serve
docker run --rm -v $(pwd):/app composer install
https://docs.docker.com/engine/reference/commandline/container_ls/
docker container ls --all
docker rm -vf $(docker ps -aq)
docker kill $(docker ps -q)
docker kill <container_id>
docker rm <container_id_or_name>
https://picsum.photos/400/300
https://dummyimage.com/250/ffffff/000000
https://dummyimage.com/250x300
https://dummyimage.com/300.png/09f/fff
https://dummyimage.com/
@mudassaralichouhan
mudassaralichouhan / isTabActive.html
Created January 6, 2024 19:33
This approach can be used to track if a user has left a webpage by switching to another browser tab or application.
<script>
var isTabActive;
window.onfocus = function () {
console.log("onfocus");
};
window.onblur = function () {
console.log("onblue");
};