Skip to content

Instantly share code, notes, and snippets.

View im-noob's full-sized avatar
🎯
I'm Iron man

Amritesh kumar im-noob

🎯
I'm Iron man
View GitHub Profile
@im-noob
im-noob / DatableSorting.js
Created July 21, 2021 12:32
Data table Sorting on hidden column from different related table
columns: [
{data: "check_box", mData: "check_box", orderable: false},
{data: "profile_pic_and_name", mData: "profile_pic_and_name"},
{data: "user.custom_user_id", mData: "user.custom_user_id"},
{data: "role", mData: "role"},
{data: "company_name", mData: "company_name"},
{data: "status", mData: "status"},
{data: "created_at", mData: "created_at"},
{data: "user.first_name", mData: "user.first_name","visible": false,},
@im-noob
im-noob / AddPaginatinTOCollection.php
Created June 24, 2021 14:38
AddPaginatinSuportTOCollection Laravel .php
Collection::macro('paginate', function($perPage, $total = null, $page = null, $pageName = 'page') {
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
return new LengthAwarePaginator(
$this->forPage($page, $perPage),
$total ?: $this->count(),
$perPage,
$page,
[
'path' => LengthAwarePaginator::resolveCurrentPath(),
@im-noob
im-noob / FixTelescopeIssue.js
Created June 10, 2021 14:38
Fix Telescope Issue Laravel
Fix telescope path issue.
Auto Load Entries
0. mkdir -p resources/views/vendor/telescope
1. cp vendor/laravel/telescope/resources/views/layout.blade.php resources/views/vendor/telescope/
2. window.Telescope.path = '{{ env('MIX_APP_NAME') }}/telescope'; in view
3. MIX_APP_NAME=Projects/catalet/public/
@im-noob
im-noob / Datatable Config Same Page.js
Created May 26, 2021 07:37
DataTable Setting On Same Config where it was
function fetch_data($project_id) {
progress_bar_start();
visible_column_list = [];
columnDefs = [];
/*Extracting Column name from List*/
column_filter.each(function () {
visible_column_list.push({'data': $(this).val()});
@im-noob
im-noob / selenium_starter2.py
Created May 22, 2021 08:54
Starter Code Selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import Select
import os
import shutil
import time
import ntpath
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
@im-noob
im-noob / AddLoader.js
Last active May 21, 2021 09:44
Add Loader in page for download reqest
// js
xhr: function()
{
var xhr = new window.XMLHttpRequest();
let duration_change = true;
//Download progress
xhr.addEventListener("progress", function(evt){
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<div class="container">
<h2>Button Styles</h2>
<button type="button" id="button1" class="btn">Basic</button>
@im-noob
im-noob / DetectAjaxRequest.js
Created April 13, 2021 07:52
Detect XHR ajax request with javascript
(function() {
var proxied = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function() {
console.log( arguments );
return proxied.apply(this, [].slice.call(arguments));
};
})();
@im-noob
im-noob / Laravel_Permission.sh
Created April 6, 2021 05:56
Laravel Permission On Server
sudo chown -R www-data:www-data html/
sudo usermod -a -G www-data root
sudo find html/ -type f -exec chmod 644 {} \;
sudo find html/ -type d -exec chmod 755 {} \;
cd html/
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
reference: https://stackoverflow.com/a/37266353
@im-noob
im-noob / PlayDifferentAudioInLinkedIn.js
Created April 3, 2021 19:51
Play Different Audio In LinkedIn
// let audio_url = 'https://media.licdn.com/media/AAMBAQQiAAgAAQAAAAAAAAriAAAAJDg2ZWY0MzhjLWQ5YTUtNDgyMy1hZjQ3LWYzM2RlOWRjZmZkYg.bin';
let audio_url = 'https://fsb.zobj.net/download/bSCIjtRQgjq9_Y6tM5IdFilYEp18rUjolRsAWyFRQ54YLXrhcs8YkPqexUvo6-8y_FSaAVLZTBAxgRJyfyJmkHU_XtboIwuG6xprhiQl9xn2FXkpi41Y0DUq7nNU/?a=web&c=72&f=small_town_boy.mp3&special=1617478235-s9coL3BX6o9WBKgaxaZf6upK89ytW4oVqSGzPyFIsZY%3D';
let audio = new Audio(audio_url);
document.getElementsByClassName('msg-thread')[0].addEventListener("DOMSubtreeModified", function() {
if( typeof play_audio_trigger !== 'undefined'){
clearTimeout(play_audio_trigger);
}
play_audio_trigger = setTimeout(function(){
play_audo();