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 / detecting-image-404.html
Created November 2, 2022 18:13
Detecting an image 404 in Javascript
<img src="{{ $vendor->image }}" onerror="ImgError(this)">
<script type="text/javascript">
function ImgError(source){
source.src = 'http://bbb.test/assets/images/placeholder.png';
source.onerror = "";
return true;
}
</script>
window.addEventListener("DOMContentLoaded", () => {
// DOM ready! Images, frames, and other subresources are still downloading.
var myModal = new bootstrap.Modal(document.getElementById('exampleModal'))
myModal.toggle()
});
@mudassaralichouhan
mudassaralichouhan / dynamic-element-create.js
Last active November 24, 2022 04:49
let clonedMenu = menu.cloneNode(true)
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>JavaScript cloneNode() Demo</title>
</head>
<body>
<ul id="menu">
<li>Home</li>
<li>Services</li>
@mudassaralichouhan
mudassaralichouhan / preview.js
Created November 28, 2022 10:00
display selected image
<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);
}
}
});
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 / index.html
Created January 18, 2023 16:48
Socket programming in PHP [mini chat app]
<!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"/>
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;
}
<?php
namespace App\WebSocket;
class Notification extends WebSocket
{
}
@mudassaralichouhan
mudassaralichouhan / phpstorm.desktop
Created January 28, 2023 14:37
move on /usr/share/application/
[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;