Skip to content

Instantly share code, notes, and snippets.

View catwhocode's full-sized avatar

Cat who code catwhocode

  • Jakarta, Indonesia
  • 17:05 (UTC +07:00)
View GitHub Profile
@catwhocode
catwhocode / guzzle-message-formatter.txt
Created July 9, 2024 05:09
Guzzle Message Formatter Supported Variable Substitution
/**
* source:
* https://github.com/guzzle/guzzle/blob/7.5/src/MessageFormatter.php#L12
*
* Formats log messages using variable substitutions for requests, responses,
* and other transactional data.
*
* The following variable substitutions are supported:
*
* - {request}: Full HTTP request message
@catwhocode
catwhocode / htaccess-flags.txt
Created July 9, 2024 02:10
.htaccess Flag List
.htaccess flag list
C Chained with next rule
CO Cookie (set specified cookie
E var:value (set Environment variable var to value)
F Forbidden - sends a 403 header to the user
G Gone - no longer exists
H Handler (set handler)
L Last - stop processing rules
@catwhocode
catwhocode / php8.1-install.sh
Created July 9, 2024 02:09
My PHP Installation Configuration Template
./configure OPENSSL_CFLAGS=-I/opt/openssl/include/ OPENSSL_LIBS="-L/opt/openssl/lib64/ -lssl -lcrypto" \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
--with-config-file-path=/etc/php \
--sysconfdir=/etc/php.d \
--enable-mysqlnd \
--with-pdo-mysql \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql=/usr/bin/pg_config \
--enable-bcmath \
--enable-fpm \
@catwhocode
catwhocode / HandlePutFormData.php
Created May 17, 2024 07:14 — forked from Stunext/HandlePutFormData.php
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
<?php
// Open the file for reading
if (($myfile = fopen("myfile.csv", "r")) !== FALSE) {
// Convert each line into the local $data variable
while (($data = fgetcsv($myfile, 1000, ",")) !== FALSE) {
// Read the data from a single line
$nama = $data[0];
$nik = $data[1];
$unit_kerja = $data[2];
@catwhocode
catwhocode / guzzle_req_res_middleware.php
Created May 7, 2024 10:08 — forked from appkr/guzzle_req_res_middleware.php
Guzzle RequestResponseLog Middleware Example
<?php
namespace App\Providers;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\Promise\PromiseInterface;
use Illuminate\Contracts\Foundation\Application;
@catwhocode
catwhocode / curl.php
Created March 15, 2024 00:43 — forked from surferxo3/curl.php
Script to demonstrate how to extract Header and Body from the Curl response in PHP.
<?php
/*#############################
* Developer: Mohammad Sharaf Ali
* Designation: Web Developer
* Version: 1.0
*/#############################
// SETTINGS
ini_set('max_execution_time', 0);
@catwhocode
catwhocode / export.sh
Created October 16, 2023 23:55
Export and remove environment variable from .env
export $(grep -v '^#' .env | xargs)
@catwhocode
catwhocode / create-subdomain.php
Created September 23, 2023 01:28 — forked from iMaz1n/create-subdomain.php
Use API/Curl to create a new subdomain in both CloudFlare and cPanel
<?php
/**
* Create Subdomains
*
* Note: This script was designed to be called silently by a bash script for project creation.
* Add to bash script: php "$HOME/scripts/php/create-subdomains.php" "$new_account_subdomain"
*
* Requires "jamesryanbell/cloudflare": "^1.11" for the CloudFlare PHP library
* Recommends "kint-php/kint": "^3.2" for improved temporary PHP debugging
@catwhocode
catwhocode / install-badaso-fresh.txt
Last active September 19, 2023 15:06
Install Badaso on Fresh Project
$ composer create-project badaso/starter myapp
# edit .env
$ php artisan migrate
$ php artisan storage:link
$ composer dump-autoload
$ php artisan db:seed --class="Database\Seeders\Badaso\BadasoSeeder"
$ php artisan badaso:admin your@email.com --create
$ npm install
$ npm run dev
$ php artisan jwt:secret