Skip to content

Instantly share code, notes, and snippets.

View PeterDKC's full-sized avatar

Peter PeterDKC

  • Omaha, NE, US
View GitHub Profile
@PeterDKC
PeterDKC / ExampleTest.php
Created February 3, 2018 16:04
Example Command Tests
<?php
namespace Tests\Command;
use PeterDKC\Sprocket\Tests\TestCase;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Console\Tester\CommandTester;
class ExampleTest extends TestCase
{
@PeterDKC
PeterDKC / app.scss
Last active February 7, 2018 22:24
Include mdi icons
$mdi-font-path: '../fonts/vendor/mdi';
@import '~mdi/scss/materialdesignicons';
@PeterDKC
PeterDKC / gist:c65d32d714d05e8ac2699b365356867b
Created September 6, 2019 15:18
My Sublime Text 3 Settings
# Keybindings
[
{ "keys": ["u+s+e+\t"], "command": "import_namespace"},
{ "keys": ["super+shift+enter"], "command": "expand_fqcn"},
{ "keys": ["alt+`"], "command": "toggle_side_bar" },
{ "keys": ["shift+enter"], "command": "goto_definition_scope" },
{ "keys": ["ctrl+shift+enter"], "command": "find_use" }
]
@PeterDKC
PeterDKC / .bash_profile
Last active May 5, 2020 17:28
Standard ~/.bash_profile for Laravel dev
# https://github.com/jimeh/git-aware-prompt
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
export PS1="\u@\h \W \[\$txtcyn\]\$git_branch\[\$txtred\]\$git_dirty\[\$txtrst\]\$ "
# https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
multi() {
@PeterDKC
PeterDKC / FooFactory.php
Last active December 19, 2019 17:28
Extend a Laravel Model Factory
<?php
// class Admin extends User
$factory->define(App\Admin::class, function (Faker\Generator $faker) {
return app(Illuminate\Database\Eloquent\Factory::class)
->raw(
Package\Models\User::class,
[
'foobar' => 'barbaz',
@PeterDKC
PeterDKC / .gitlab-ci.yml
Last active April 5, 2020 23:56
Working .gitlab-ci.yml for a non-Dockerized Laravel App
stages:
- build
- test
# Speed up builds
cache:
key: $CI_BUILD_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x
paths:
- vendor/
@PeterDKC
PeterDKC / MyUnitTest.php
Created April 7, 2020 20:11
Helper method to Mock a Guzzle Client in a PHPUnit test within a Laravel Application
<?php
namespace Tests\Unit;
use Tests\TestCase;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Handler\MockHandler;
<?php
namespace App\Models;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Foo extends Model
{
# https://github.com/jimeh/git-aware-prompt
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
export PS1="\u@\h \W \[\$txtcyn\]\$git_branch\[\$txtred\]\$git_dirty\[\$txtrst\]\$ "
echo 'export PATH="/usr/local/sbin:$PATH"'
alias minimal-prompt="PS1='\$> '"
alias short-prompt="PS1='\W \$ '"