Skip to content

Instantly share code, notes, and snippets.

View ianmustafa's full-sized avatar

Ian Mustafa ianmustafa

  • Bojonegoro, Indonesia
View GitHub Profile
@ianmustafa
ianmustafa / imageoptim.php
Last active February 23, 2023 06:20
Optimalisasi Gambar dalam PHP menggunakan Imagick.
<?php
/* Maafkan kalo penamaan variabelnya berantakan 😁
Ini juga agak lambat karena kompleksitasnya, terutama
di baris 61-95 (pembuatan gambar latar yang di-blur
untuk mengisi ruang kosong / menghindari crop)
*/
function imageoptim($imagepath, $savename) {
// Set imagepath default
$imagepath = "upload/source/{$savename}";
@ianmustafa
ianmustafa / 0-preface.md
Last active March 21, 2023 15:35
PHP: cURL vs file_get_contents

PHP: cURL vs file_get_contents()

This is a very often asked question among PHP developers. This gist aims to answer it.

Case study

RajaOngkir API.

Benchmark

  • Done in DigitalOcean, cheapest droplet ($5), located in Singapore, using Ubuntu Server 18.04.3. (Referral link for anybody interested.)
  • System configured with (mostly) default configuration, using what's available from the package installation.
@ianmustafa
ianmustafa / index.php
Last active April 5, 2023 19:45
Composer Autoload in CodeIgniter. This method provides Cmposer autoloader to be loaded before CodeIgniter classes. Useful to be used with dotenv file using PHP Dotenv package by josegonzalez.
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
*
@ianmustafa
ianmustafa / instal-php-di-ubuntu.md
Last active November 6, 2023 03:07
Instal PHP di Ubuntu dan keluarganya? Tak perlu bingung lagi!

Instal PHP di Ubuntu dan Keluarganya? Tak perlu bingung lagi!

Thanks to Ondřej Surý, semua jadi lebih mudah. Instal berbagai versi PHP secara bersamaan pun bisa.