Skip to content

Instantly share code, notes, and snippets.

View shohag-cse-knu's full-sized avatar

Syfur Rahaman Shohag shohag-cse-knu

View GitHub Profile
@shohag-cse-knu
shohag-cse-knu / Visual Studio 2022 Product Key
Created February 14, 2024 03:10
Visual Studio 2022 Enterprise Product key
Visual Studio 2022
Enterprise :
VHF9H-NXBBB-638P6-6JHCY-88JWH
Professional:
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
@shohag-cse-knu
shohag-cse-knu / js_backspace_denied.js
Last active December 17, 2024 05:04
Backspace denied in webpages without form fields
//Backspace won't work in webpage without form fields
$(document).on("keydown", function (event) {
if (event.keyCode === 8 && !$(event.target).is("input, textarea")) {
event.preventDefault();
}
});
@shohag-cse-knu
shohag-cse-knu / js_call_a_function_after_complete_page_load.js
Created December 17, 2024 05:06
Javascript calling a function or operations after complete page load
document.onreadystatechange = function(){
if(document.readyState === 'complete'){
// Your Code here
}
}
@shohag-cse-knu
shohag-cse-knu / js_mobile_no_validation.js
Created December 17, 2024 05:11
Mobile Number of BD validation by JS
function mobile_no(val){
if((/^(017|018|016|015|011|019)\d{8}/).test(val)) {
return true;
else
return false;
}
@shohag-cse-knu
shohag-cse-knu / js_print_div.js
Created December 17, 2024 05:14
Print the div following by a html id with JS
//This will print the inner printarea id
function print_div(){
var printContents = document.getElementById('printarea').innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
@shohag-cse-knu
shohag-cse-knu / js_table_header_fixed.js
Created December 17, 2024 05:20
Table header fixed by JS
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sticky-table-headers/0.1.24/js/jquery.stickytableheaders.js"></script>
<script>
$("#table_name").stickyTableHeaders();
</script>
@shohag-cse-knu
shohag-cse-knu / php_2d_array_column_search_index_return.php
Created December 17, 2024 06:27
Array column search in 2D array and return the index and it's corresponding parameters.
<?php
$arr_dist_sro = array(
array('id'=>127, 'district'=>'field_6', 'sro'=>'field_9'),
array('id'=>128, 'district'=>'field_6', 'sro'=>'field_7'),
array('id'=>133, 'district'=>'field_4', 'sro'=>'field_6'),
array('id'=>136, 'district'=>'field_6', 'sro'=>'field_7'),
array('id'=>145, 'district'=>'field_4', 'sro'=>'field_5')
);
$search_id = 133;
@shohag-cse-knu
shohag-cse-knu / codeigniter_multiple_file_downloaded_zip.php
Created December 17, 2024 06:32
Customer all files are downloaded in a zip with Codeigniter
<?php
function download_zip($customer_id=NULL){
$this->load->library('zip');
$this->load->helper('file');
$query = $this->db->query("SELECT * FROM customers WHERE customer_id = $customer_id")->row();
$path ='customer_files/';
$arr_file = explode(',', $query->cust_file);
foreach ($arr_file as $a_file) {
$this->zip->read_file($path.$a_file,TRUE);
//$this->zip->read_file($path.$a_file,FALSE); //Folder Directory won't be added
@shohag-cse-knu
shohag-cse-knu / php_console_show.php
Created December 17, 2024 06:35
To show the variables in console log in php script
<?php
//Here data is your variable or object or array
echo "<script type='text/javascript'>console.log(".json_encode($data).");</script>";
?>
@shohag-cse-knu
shohag-cse-knu / php_convert_money_to_words.php
Created December 17, 2024 06:39
Converting the number of money in words
<?php
function convert_number_to_words($number) {
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
$decimal = ' point ';
$dictionary = array(
0 => 'zero',