Skip to content

Instantly share code, notes, and snippets.

View ppabcd's full-sized avatar
🏠
Working from home

Reza Juliandri ppabcd

🏠
Working from home
View GitHub Profile
@ppabcd
ppabcd / sort.php
Created June 2, 2019 09:28
Sort File by Extension Inside Folder Using PHP
<?php
$folder = __DIR__."/experimen/";
$moved_folder = __DIR__."/hasil/";
$extensions = [
"gambar" => ["jpg","png", "jpeg", "JPG", "svg"],
"video" => ["mkv", "mp4"],
"musik" => ["mp3"],
"document" => ["pdf","txt","xls", "epub", "docx", "xlsb"],
"compressed" => ["rar","zip", "tar.gz"],
"programming" => ["php", "py", "sql", "js", "html", "htm", "map", "phar"],
@ppabcd
ppabcd / .php_cs.service.php
Last active June 18, 2020 07:42
.php_cs.laravel.php
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => null]
@ppabcd
ppabcd / pre-commit
Last active March 21, 2022 11:19
Pre-commit file for fix php files
#!/bin/sh
FILE="${PWD}/.php_cs.service.php"
COMMAND="/usr/bin/php-cs-fixer"
CONFIG_URL="https://gist.githubusercontent.com/ppabcd/d0184b7ba0f05b9ed59bd0d12753a5a6/raw/f76e893696b205278d40412f6fd4a2e8e78b399f/.php_cs.service.php"
# Version and Release Manager
VERSION_FILE="${PWD}/.version"
RELEASE="${PWD}/release"
VERSION="0.1.0"
TEXT_VERSION="v0.1.0"
@ppabcd
ppabcd / prepare-commit-msg
Created March 21, 2022 12:01
prepare-commit-msg
#!/bin/sh
COMMIT_MESSAGE_FILE=$1
VERSION_FILE="${PWD}/.version"
TEXT_VERSION="v0.1.0"
if [ -f "$VERSION_FILE" ]; then
# Read file
VERSION=$(cat "$VERSION_FILE")
# delete v from text
@ppabcd
ppabcd / prepare-commit-msg
Created August 1, 2022 09:20
Prepare commit without PHP
#!/bin/sh
COMMIT_MESSAGE_FILE=$1
VERSION_FILE="${PWD}/.version"
TEXT_VERSION="v0.1.0"
if [ -f "$VERSION_FILE" ]; then
# Read file
VERSION=$(cat "$VERSION_FILE")
# delete v from text
@ppabcd
ppabcd / pre-commit
Created August 1, 2022 09:33
pre-commit without php
#!/bin/sh
# Version and Release Manager
VERSION_FILE="${PWD}/.version"
RELEASE="${PWD}/release"
VERSION="0.1.0"
TEXT_VERSION="v0.1.0"
if [ -f "$VERSION_FILE" ]; then
# Read file
@ppabcd
ppabcd / pre-commit
Created September 10, 2022 12:22
Pre commit and only increment while release
#!/bin/sh
FILE="${PWD}/.php_cs.service.php"
COMMAND="/usr/bin/php-cs-fixer"
CONFIG_URL="https://gist.githubusercontent.com/ppabcd/d0184b7ba0f05b9ed59bd0d12753a5a6/raw/f76e893696b205278d40412f6fd4a2e8e78b399f/.php_cs.service.php"
# Version and Release Manager
VERSION_FILE="${PWD}/.version"
RELEASE="${PWD}/release"
VERSION="0.1.0"
TEXT_VERSION="v0.1.0"
@ppabcd
ppabcd / dynamic_fixer
Created September 10, 2022 12:27
Dynamic Fixer
#!/bin/sh
wget https://gist.githubusercontent.com/ppabcd/1441d22056a30d084da7138b1ab16bf9/raw/pre-commit
mv ./pre-commit ./.git/hooks/pre-commit
rm -rf ./.git/hooks/prepare-commit-msg
chmod +x ./.git/hooks/pre-commit
@ppabcd
ppabcd / redis-expire-set.sh
Created September 13, 2022 10:00
Redis set keys expirations
#!/bin/bash
if [ $# -ne 4 ]
then
echo "Usage: $0 <host> <port> <pattern> <seconds>"
exit 1
fi
cursor=-1
keys=""
@ppabcd
ppabcd / .php-cs-fixer.php
Created September 23, 2023 10:29 — forked from laravel-shift/.php-cs-fixer.php
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',