Skip to content

Instantly share code, notes, and snippets.

View smunchi's full-sized avatar
🎯
Focusing

Md. Salahuddin smunchi

🎯
Focusing
  • Dhaka, Bangladesh
View GitHub Profile
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
print_r(get_content('https://abc.com/api/get-customers')); exit();
@smunchi
smunchi / gist:a4f1ef89fe56b9d45b38f785a23ea748
Created November 10, 2021 07:30
integers to roman conversion
function integersToRomanNumeral($number)
{
$values = [1000, 500, 100, 50, 10, 5, 1];
$romanNumerals = ['M', 'D', 'C', 'L', 'X', 'V', 'I'];
$result = [];
for($i = 0; $i<count($values); $i++) {
while($number >= $values[$i]) {
$number = $number - $values[$i];
$result[] = $romanNumerals[$i];
@smunchi
smunchi / gist:4f0aab1990fbf1ec7045cb285fa8067a
Created November 2, 2021 11:07
How to remove duplicate frequnecy in php array data
$arrayData = [2,2,2,5];
$filterData = array_filter(array_count_values($arrayData), function ($value) {
return $value == 1;
});
print_r($filterData);
@smunchi
smunchi / gist:5118cd674362feef8f0f
Created June 15, 2015 02:23
Use of z index css property
Position an image behind the text
img {
position: absolute;
left: 0px;
top: 0px;
z-index: -1;
}
<h1>This is a heading</h1>
@smunchi
smunchi / gist:888af1499974a21694da
Last active August 29, 2015 14:22
Use of HTTP_REFERER to delete session data
Use of $_SERVER['HTTP_REFERER'];
I assume in a.php
<?php
session_start();
$_SESSION['hello'] = "Your content here";
?>
In b.php you want to show your session data and you are also checking what is the previous page
@smunchi
smunchi / gist:3c24798f795dc477c68c
Created June 10, 2015 04:08
position or display file input with custom style or text
<form method="POST" action="myurl">
<span class="btn btn-success fileinput-button">
<span>Select file</span>
<input type="file" name="file"/>
</span>
</form>
/*Copied from bootstrap */
@smunchi
smunchi / textarea autogrow or expadable height
Last active August 29, 2015 14:17
Textarea autogrow with jQuery
Here is a simple textarea:
<textarea name="content" id="content" class="form-control"></textarea>
Textarea will be expandable based on content height and also for content pasting.
$('textarea#content').on('keyup input', function() {
resizeTextarea(this);
});