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 / 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));
};
})();
<!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 / 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;
@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 / 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 / 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 / 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 / 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 / selenium_starter3.py
Last active December 13, 2021 15:16
Selenium Starter 3 Python
# !apt-get update
# !apt install chromium-chromedriver
# !cp /usr/lib/chromium-browser/chromedriver /content/drive/MyDrive/Colab\ Notebooks
# !pip install selenium
# !chmod 0777 chromedriver
import json
import os
from time import sleep
@im-noob
im-noob / twitter_trend_analyser.py
Created August 2, 2021 19:09
Twitter Trend Analyser in Python
import json
import os
from datetime import datetime
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException