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 / decorator.ts
Last active December 24, 2023 09:44
Example of decorator @command, @Listener and @callbackQuery for telegram bot with grammY and inversify
/* eslint-disable @typescript-eslint/no-explicit-any */
import {ICommand} from "../core/ICommand"
import {IListener} from "../core/IListener"
import {ICallbackQuery} from "../core/ICallbackQuery"
import {kylaContainer} from "../../../di/inversify.config"
import {Container, injectable as originalInjectable} from "inversify"
import {promises as fs} from "fs"
import path from "path"
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@ppabcd
ppabcd / laravel10-fixer.sh
Last active October 2, 2023 07:21
Laravel 10 Fixer
#!/bin/sh
wget -O pre-commit "https://gist.githubusercontent.com/ppabcd/176d0276e047f89b16596f9a5fdb4aa2/raw/pre-commit?$(date +%s)"
mv ./pre-commit ./.git/hooks/pre-commit
rm -rf ./.git/hooks/prepare-commit-msg
chmod +x ./.git/hooks/pre-commit
@ppabcd
ppabcd / pre-commit
Last active November 8, 2023 08:29
Laravel 10 pre-commit
#!/bin/sh
FILE="${PWD}/.php-cs-fixer.php"
COMPOSER_PATH="/usr/bin/composer"
COMMAND="lint"
CONFIG_URL="https://gist.githubusercontent.com/ppabcd/0dc95e7130ba46e9edc095ca57f23af6/raw/db5b07ee97ddbd2e2183d86ab996a0fefacc4dea/.php-cs-fixer.php"
# Version and Release Manager
VERSION_FILE="${PWD}/.version"
RELEASE="${PWD}/release"
VERSION="0.1.0"
@ppabcd
ppabcd / .php-cs-fixer.php
Created October 2, 2023 06:45
Laravel 10 Fixer
<?php
use PhpCsFixer\Config;
use PhpCsFixer\DocBlock\TypeExpression;
use PhpCsFixer\Finder;
use PhpCsFixer\Fixer\FixerInterface;
use PhpCsFixer\FixerDefinition\FixerDefinition;
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
use PhpCsFixer\Tokenizer\Token;
use PhpCsFixer\Tokenizer\Tokens;
@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',
@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 / 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 / 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 / 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 / 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