This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Laravel Coding Standards with FluxUI | |
## PHP Standards | |
- When creating new PHP files, **always** add the `<?php` to the top of the file | |
- Use PHP v8.4 features | |
- Follow `pint.json` coding rules | |
- Enforce strict types and array shapes via PHPStan | |
- Use strict typing: `declare(strict_types=1)` but **NEVER** on `.blade.php` files. Only `.php` | |
- Follow PSR-12 coding standards | |
- Use descriptive variable and method names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Traits; | |
use Illuminate\Database\Eloquent\Builder; | |
trait HasEmbedding | |
{ | |
public function scopeNeedsEmbedding(Builder $query): Builder | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Livewire\Accounts; | |
use Livewire\Component; | |
use Illuminate\Support\Arr; | |
use Illuminate\Support\Facades\Http; | |
use App\Services\ApiHeaders; | |
class Test extends Component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Http::withHeaders([ | |
'accept' => 'application/json' | |
]) | |
->withToken('apiKey123') | |
->get('https://some.server.com/api/v1/customers') | |
->json(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# l project-name -a -g -d | |
# | |
# Available options: | |
# -a Authentication scaffolding with tests | |
# -g Add Github remote | |
# -d Create a fresh MySQL database | |
# Laravel Zonda | |
function l { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @test */ | |
public function it_converts_currency_to_cents_if_dollar_sign() | |
{ | |
$this->assertEquals(6500, convertCurrencyToCents('$65')); | |
$this->assertEquals(6600, convertCurrencyToCents('$66.00')); | |
$this->assertEquals(6750, convertCurrencyToCents('$67.50')); | |
$this->assertEquals(2500, convertCurrencyToCents('25.00')); | |
$this->assertEquals(3300, convertCurrencyToCents('33')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// this script receives a Stripe dispute / chargeback and: | |
// | |
// - immediately refunds the payment | |
// - closes the user's account (in my DB, add your own code there) | |
// | |
// this is to automate dispute handling (because you never win a dispute on Stripe anyway) | |
// and by refunding avoiding the chargeback fee | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Paths | |
export PATH=$HOME/bin:$PATH | |
export PATH=/usr/local/bin:$PATH | |
export PATH=$HOME/.composer/vendor/bin:$PATH | |
export PATH=vendor/bin:$PATH | |
export PATH=vendor/phpunit/phpunit:$PATH | |
export PATH="$HOME/.yarn/bin:$PATH" | |
# Setup xdebug | |
export XDEBUG_CONFIG="idekey=VSCODE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Switch PHP versions | |
phpv() { | |
valet stop | |
brew unlink [email protected] [email protected] [email protected] | |
brew link --force --overwrite $1 | |
brew services start $1 | |
composer global update | |
valet install | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Misc | |
# -------------------------------------------- | |
alias s="subl" | |
alias rip="rm -rf" | |
alias vc="code" | |
alias p="pstorm" | |
alias dev="cd ~/dev" | |
alias codee="cd ~/Dropbox/Code" | |
alias c="composer" | |
alias cu="COMPOSER_MEMORY_LIMIT=-1 composer update" |
NewerOlder