Skip to content

Instantly share code, notes, and snippets.

@fians
fians / TestCase.php
Created September 5, 2020 16:45
Warning: assertExactJson() doesn't respect order of elements on Laravel v7.x (or older)
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
LogFormat "%h %l %u %t \"%r\" %>s %O %{ms}T \"%{Referer}i\" \"%{User-agent}i\"" combined
@fians
fians / aws-iam-policy-for-flysystem-adapter-policy.md
Created February 5, 2018 05:13
AWS IAM Policy for flysystem-adapter-s3-v3

AWS IAM Policy for flysystem-adapter-s3-v3

You can copy AWS IAM policy below to secure the access of your AWS S3 bucket when using S3 Adapter of Flysystem

{
    "Version": "2012-10-17",
    "Statement": [
 {
@fians
fians / convert.md
Created February 3, 2018 11:50
Use FFMPEG to convert WAV files to MP3 for Nexmo Stream Audio

Use FFMPEG to convert WAV files to MP3 for Nexmo Stream Audio

Nexmo allow us to setup Stream NCCO object to stream a speech sound to the call receiver. Here is some specification of the allowed sound format for stream url:

MP3:

  • MPEG Audio Layer 3, version 2
  • Constant bit rate
  • Bit rate: 16 Kbps (8, 32, 64 also supported)
@fians
fians / optimize.php
Created January 3, 2018 10:24
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/