Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Programming iz Thing!

Mudassar Ali Chouhan mudassaralichouhan

😎
Programming iz Thing!
  • Pakistan
  • 16:45 (UTC -04:00)
View GitHub Profile
View regex.txt
(http|ftp|https|ws|wss):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])
@mudassaralichouhan
mudassaralichouhan / select.js
Created February 1, 2023 08:55
multi select get values
View select.js
let checked = document.querySelectorAll('form#group-store select[name="employees[]"] :checked');
checked = [...checked].map(option => option.value)
@mudassaralichouhan
mudassaralichouhan / WebSocket.php
Last active January 31, 2023 11:46
web socket example
View WebSocket.php
<?php
class WebSocket
{
private array $clients = [];
private $server;
private int $sleep = 0;
@mudassaralichouhan
mudassaralichouhan / deepCopy.js
Created January 30, 2023 20:36
clone element with recursively in JavaScript
View deepCopy.js
function deepClone(obj) {
/*
* Duplicates an object
*/
var ret = null;
if (obj !== Object(obj)) { // primitive types
return obj;
}
if (obj instanceof String || obj instanceof Number || obj instanceof Boolean) { // string objecs
@mudassaralichouhan
mudassaralichouhan / phpstorm.desktop
Created January 28, 2023 14:37
move on /usr/share/application/
View phpstorm.desktop
[Desktop Entry]
Version=2021.2.2
Name=PHP Storm
Comment=PHP Programing Web IDE Text Editor
Keywords=Programming;IDE;Web;Text;Editor
Exec=/opt/php-storm-212.5284.49/bin/phpstorm.sh
Terminal=false
Type=Application
Icon=/opt/php-storm-212.5284.49/bin/phpstorm.svg
Categories=JetBrain;Programming;WebIDE;
View Notification.php
<?php
namespace App\WebSocket;
class Notification extends WebSocket
{
}
View js-issues-form.js
const from = document.querySelector('form#group-send-message');
from.onsubmit = (e) => {
e.preventDefault();
const selectedGroup = document.querySelector('div[data-active]');
if (! selectedGroup) {
swal('Please! first Select a group chat.', 'error');
return;
}
@mudassaralichouhan
mudassaralichouhan / index.html
Created January 18, 2023 16:48
Socket programming in PHP [mini chat app]
View index.html
<!DOCTYPE html>
<html lang="">
<head>
<meta charset='UTF-8'/>
<title>Chat Room</title>
</head>
<body>
<input type="text" name="name">
<input type="text" name="message"/>
View reset.sh
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
echo "Resetting trial period for $product"
echo "removing evaluation key..."
rm -rf ~/.config/$product*/eval
# Above path not working on latest version. Fixed below
rm -rf ~/.config/JetBrains/$product*/eval
echo "removing all evlsprt properties in options.xml..."
@mudassaralichouhan
mudassaralichouhan / preview.js
Created November 28, 2022 10:00
display selected image
View preview.js
<script>
document.querySelectorAll('input[type="file"]').forEach((el, index) => {
el.onchange = e => {
const file = e.target.files[0];
if ( file ) {
el.closest('div[class*="col-md"]')
.querySelector('img').src = URL.createObjectURL(file);
}
}
});