Skip to content

Instantly share code, notes, and snippets.

View MKaidan's full-sized avatar

Aidan Hakimian MKaidan

View GitHub Profile
@GeniJaho
GeniJaho / 5-image-convertion.php
Created November 9, 2021 20:30
5 - Image convertion
<?php
...
private const TEMP_HEIC_STORAGE_DIR = 'app/heic_images/';
protected function convertHeic(UploadedFile $file): \Intervention\Image\Image
{
$extension = $file->getClientOriginalExtension();
// Generating a random filename, and not using the image's
@sean3z
sean3z / pagination.php
Last active May 10, 2022 19:09
Pagination example
<?php
function handle_pagination($total, $page, $shown, $url) {
$pages = ceil( $total / $shown );
$range_start = ( ($page >= 5) ? ($page - 3) : 1 );
$range_end = ( (($page + 5) > $pages ) ? $pages : ($page + 5) );
if ( $page >= 1 ) {
$r[] = '<span><a href="'. $url .'">&laquo; first</a></span>';
$r[] = '<span><a href="'. $url . ( $page - 1 ) .'">&lsaquo; previous</a></span>';
$r[] = ( ($range_start > 1) ? ' ... ' : '' );
@jrdmb
jrdmb / SHA-256 VBScript.vbs
Last active April 20, 2023 06:46
VBScript code for SHA-256 hash
'also see: https://gist.github.com/anonymous/573a875dac68a4af560d
Option Explicit
Dim intValid
Dim objMD5, objSHA256
Dim strAlgorithm, strHash, strString
intValid = 0