This file contains 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 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 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 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 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 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 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 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" |
This file contains 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
sudo apt-get update && sudo apt-get install -y imagemagick php-imagick && sudo service php7.0-fpm restart && sudo service nginx restart |
This file contains 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\Billing; | |
class FakePaymentGateway implements PaymentGateway | |
{ | |
const TEST_CARD_NUMBER = '4242424242424242'; | |
private $charges; | |
private $tokens; |
NewerOlder