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 / DataTableLaravel.js
Last active February 12, 2021 13:45
Data Table Laravel snips
$(function () {
let data_table = $('#data-table');
let data_table_object = null;
fetch_data()
function fetch_data() {
if (data_table_object != null) {
data_table_object.destroy();
}
data_table_object = data_table.DataTable({
@im-noob
im-noob / DataTableBackend.php
Created February 12, 2021 13:33
DataTableBackend.php
$data = User::all();
$dataTable = DataTables::collection($data)
->editColumn('check_box', static function ($value) {
return '<td>
<div class="checkbox">
<input type="checkbox" name="check" value="checkbox" class="row-check-box-active-table">
<label for="checkbox"></label>
</div>
</td>';
})->editColumn('profile_pic_and_name', static function ($value) {
let certificate_search_ele = $('#certificate-search');
let certificate_list_text_ele = $('.certificate-list-text');
let certificate_category_ele = $('#certificate_category');
function applyFilters() {
/*Search Filter */
let value = certificate_search_ele.val().toLowerCase();
certificate_list_text_ele.filter(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
@im-noob
im-noob / redirection.php
Created March 5, 2021 23:58
Redirection in php
# index.php
<?php
$REQUEST_URI = $_SERVER['REQUEST_URI'];
$REQUEST_URI_split = explode('/',$REQUEST_URI);
$SCRIPT_NAME = $_SERVER['SCRIPT_NAME'];
$SCRIPT_NAME_split = explode('/',$SCRIPT_NAME);
$intersection_length = count(array_intersect($REQUEST_URI_split,$SCRIPT_NAME_split));
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>The page you were looking for doesn't exist (404)</title>
<meta name="robots" content="noindex">
<style type="text/css">
body {
background:#fafafa;
font-family: 'Open Sans', sans-serif;
font-weight:300;
color:#979997;
@im-noob
im-noob / first_url_from_google.py
Created March 27, 2021 18:34
Find First Url from Google Search
import requests
from bs4 import BeautifulSoup
import time
search = input('Search: ')
searched_url = 'https://www.google.com/search?q='+search.replace(' ','+')
# googling
page = requests.get(searched_url)
@im-noob
im-noob / WeatherJavaScriptByLatLong.js
Created April 1, 2021 12:05
Weather Java Script By Lat Long
<script>
$(function () {
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(fetchPosition);
} else {
$('.wether-section').hide();
console.log("Geolocation is not supported by this browser.");
}
}
@im-noob
im-noob / gist:4a884b777712669c8a9fc191c4760ee9
Created April 3, 2021 18:45 — forked from alecperkins/gist:3889507
Detect any XMLHttpRequests
// From: http://stackoverflow.com/questions/3596583/javascript-detect-an-ajax-event
var s_ajaxListener = new Object();
s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
s_ajaxListener.callback = function () {
// this.method :the ajax method used
// this.url :the url of the requested script (including query string, if any) (urlencoded)
// this.data :the data sent, if any ex: foo=bar&a=b (urlencoded)
console.log(this.method);
@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();
@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