Skip to content

Instantly share code, notes, and snippets.

View sohelrana820's full-sized avatar
💭
I may be slow to respond.

Sohel Rana sohelrana820

💭
I may be slow to respond.
View GitHub Profile
@sohelrana820
sohelrana820 / hover.css
Last active February 9, 2024 18:53
How to stop navbar items shaking on css hover
/**
* Put anchor (<a> tag) link text inside the title attribute text
**
.link::before {
display: block;
content: attr(title);
font-weight: 600;
height: 0;
overflow: hidden;
visibility: hidden;
@sohelrana820
sohelrana820 / catch-php-output-buffering-data-jquery-ajax.php
Last active December 12, 2023 14:20
Get Streaming Data Over Jquery Ajax
<?php
/**
* Catch php output buffering data over jQuery AJAX
*
* @author: Sohel Rana (me.sohelrana@gmail.com)
* @author url: https://blog.sohelrana.me
* @link: https://blog.sohelrana.me/catch-php-output-buffering-data-jquery-ajax/
* @licence MIT
*/
@sohelrana820
sohelrana820 / email.php
Last active July 25, 2023 02:41
Send Email Through AJax
<?php
$data = $_POST['data'];
$name = $data['name'];
$from = $data['email'];
$subject = $data['subject'];
$message = $data['message'];
$to = 'hayley@studioeighty7.co.uk';
$headers = "MIME-Version: 1.0";
$headers .= "Content-type: text/plain; charset=iso-8859-1";
@sohelrana820
sohelrana820 / create_and_download_zip.php
Last active May 7, 2023 19:53
Create and download ZIP file in PHP
<?php
/**
* @author: Sohel Rana <me.sohelrana@gmail.com>
* @author URI: http://sohelrana.me
* @description: Create zip file and download in PHP
*/
function createZipAndDownload($files, $filesPath, $zipFileName)
{
// Create instance of ZipArchive. and open the zip folder.
@sohelrana820
sohelrana820 / sort_multidimensional_array_by_time.php
Last active February 7, 2023 16:51
How to sort PHP multidimensional array by timestamp
// Feeds array with title and time
$feeds = array(
array(
'title' => 'Some Feeds.',
'time' => '2015-03-31 13:06:00'
),
array(
'title' => 'And another.',
'time' => '2015-03-23 13:06:00'
),
@sohelrana820
sohelrana820 / OrdinaryCarsController.php
Last active July 12, 2022 08:20
Delete file after download
```php
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $zip['name']);
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
//header('Content-Length: ' . $size);
@sohelrana820
sohelrana820 / minio-commands.md
Last active July 7, 2022 07:02 — forked from a-h-abid/example.lifecycle.json
MinIO MC Commands Quick Sheet

MinIO Commands

## Alias to Minio Server
mc alias set myminio http://localhost:9000 <access-key> <secret-key>

## List Directories (Root Buckets + Directories)
mc ls myminio
mc ls myminio bucket/folder
@sohelrana820
sohelrana820 / html-to-pdf.html
Last active July 3, 2022 10:00
HTML to PDF using jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML to PDF</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<main>
@sohelrana820
sohelrana820 / expression.txt
Created June 21, 2022 05:57
Regular Expression for Validating Bangladeshi Mobile number
Regulat Expression Patter: ^(?:\\+?\\+880|880|0)?1\d{9}$
Input:
============
01711091770
00711091770
1711091770
8801711091770
881711091770
@sohelrana820
sohelrana820 / print_external_page_without_opening_it.html
Created September 16, 2018 10:28
Print an external page without opening it
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MDN Example</title>
<script type="text/javascript">
function closePrint () {
document.body.removeChild(this.__container__);
}