Skip to main content

Posts

python setup

after installation of python3 and pip and virtual environment now: Saws-MBP:travel-django sawbean$ virtualenv -p python3 venv to create virtual environment now install django and all other imp stuffs there

laravel file manager sorting by time default

Ref :  https://github.com/UniSharp/laravel-filemanager/issues/337 To load files order by "time DESC" you can change the code in vendor/unisharp/laravel-filemanager/src/traits/LfmHelpers.php public function sortFilesAndDirectories($arr_items, $sort_type) { if ($sort_type == 'time') { $key_to_sort = 'updated'; } elseif ($sort_type == 'alphabetic') { $key_to_sort = 'name'; } else { $key_to_sort = 'updated'; } return strcmp($a->{$key_to_sort}, $b->{$key_to_sort}); }); return $arr_items; } with public function sortFilesAndDirectories($arr_items, $sort_type) { if ($sort_type == 'time') { $key_to_sort = 'updated'; } elseif ($sort_type == 'alphabetic') { $key_to_sort = 'name'; } else { $key_to_sort = 'updated'; ...

key press function to perform system function

document.onkeyup = function(e) {   if (e.which == 77) {     alert("M key was pressed");   } else if (e.ctrlKey && e.which == 66) {     alert("Ctrl + B shortcut combination was pressed");   } else if (e.ctrlKey && e.altKey && e.which == 89) {     alert("Ctrl + Alt + Y shortcut combination was pressed");   } else if (e.ctrlKey && e.altKey && e.shiftKey && e.which == 85) {     alert("Ctrl + Alt + Shift + U shortcut combination was pressed");   } }; < script > $ ( document ). ready ( function () { $ ( '[data-toggle="tooltip"]' ). tooltip (); $ ( document ). keyup ( function ( e ) { var name = e . key ; // console.log(e.which); // if(e.shiftKey && e.which == 80) // { // } // alert(name); switch ( e . key ){ ...

print in loop in php easy way

<script type="text/javascript"> function PrintDiv() { var divToPrint = document.getElementById('divToPrint'); var popupWin = window.open('', '_blank', 'width=300,height=300'); popupWin.document.open(); popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>'); popupWin.document.close(); } </script> <div id="divToPrint" style="display:none;"> <div style="width:200px;height:300px;background-color:teal;"> <?php echo $html; ?> </div> </div> <div> <input type="button" value="print" onclick="PrintDiv();" /> </div>

Auto posting on facebook

Reference: https://packagist.org/packages/laravel-notification-channels/facebook-poster https://sujipthapa.co/blog/generating-never-expiring-facebook-page-access-token for image also: https://techanical-atom.com/post-on-facebook-page-via-laravel-notification/?fbclid=IwAR374VsySPcqW2tt78xByxEH1kNNNHX74D-q62Fd-wYr3rzDQ91JA7-4RpA https://sujipthapa.co/blog/automatically-posting-to-facebook-page-via-laravel-notifications sub: https://github.com/alihesari/laravel-social-auto-posting?fbclid=IwAR002Nv3tkonSNiG--FXw2_V9zUhwAsFi8WApfWiUMV-tvCSWQ9-IL5H6g4 Let me explain what i have done here... composer require laravel - notification - channels / facebook - poster inside config/server.php: 'facebook_poster' = > [ 'app_id' = > env ( 'FACEBOOK_APP_ID' ) , 'app_secret' = > env ( 'FACEBOOK_APP_SECRET' ) , 'access_token' = > env ( 'FACEBOOK_ACCESS_TOKEN' ) , ] , Now, create notif...

Stand Alone integration og file manager laravel

Reference:  https://unisharp.github.io/laravel-filemanager/integration <! doctype html > < html lang = "en" > < head > < meta charset = "UTF-8" > < title > Laravel Filemanager </ title > < link rel = "shortcut icon" type = "image/png" href = " {{ asset ('vendor/laravel-filemanager/img/folder.png') }} " > < link rel = "stylesheet" href = "//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" > < link rel = "stylesheet" href = "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" > </ head > < body > < div class = "container" > < div class = "row" > < div class = "col-md-6" > < h2 > Standalone Image Button </ h2 > < div class = "input-group" > < span class = "i...