Skip to content

Instantly share code, notes, and snippets.

@owenconti
owenconti / 5ec89f9e560f2.js
Last active May 24, 2020 00:27
Using GitHub's Gists for embedded code blocks on your Statamic v3 site
const foo = {'bar': 123};
@owenconti
owenconti / 5ec6d9e0e7414.sh
Created May 21, 2020 19:43
How to fix PHPUnit splitting dots onto new lines
PHPUnit 8.5.3 by Sebastian Bergmann and contributors.
..
.
.
.
. 6 / 6 (100%)
@owenconti
owenconti / 5ec68846dc68f.sh
Created May 21, 2020 13:55
Improve the performance of Laravel feature tests using MySQL instead of SQLite or memory databases
PHPUnit 8.5.3 by Sebastian Bergmann and contributors.
............................................................... 63 / 495 ( 12%)
............................................................... 126 / 495 ( 25%)
............................................................... 189 / 495 ( 38%)
............................................................... 252 / 495 ( 50%)
............................................................... 315 / 495 ( 63%)
............................................................... 378 / 495 ( 76%)
............................................................... 441 / 495 ( 89%)
...................................................... 495 / 495 (100%)
@owenconti
owenconti / 5ec6879352fd7.php
Created May 21, 2020 13:52
Calling Laravel seeders from migrations
<?php
// inside migration file
public function up()
{
// Create a table here
// Call seeder
Artisan::call('db:seed', [
'--class' => 'SampleDataSeeder',
@owenconti
owenconti / 5ec686c71fa61.php
Created May 21, 2020 13:48
Faking the Queue in Laravel tests
<?php
/** @test */
public function it_fails_attach_volume_to_instance_if_volume_is_not_in_provisioning_state() {
Event::fake([JobFailed::class]);
$queue = Queue::getFacadeRoot();
Queue::fake();
$volume = VolumeFactory::make()->pending()->create();
@owenconti
owenconti / 5ec34688aeadd.json
Created May 19, 2020 02:38
Using aliases in Composer to update depedencies without a fork
"require": {
"php" : "^7.2.5",
"illuminate/auth": "^5.8|^6.0|^7.0",
"illuminate/container": "^5.8|^6.0|^7.0",
"illuminate/contracts": "^5.8|^6.0|^7.0",
"illuminate/database": "^5.8|^6.0|^7.0"
},
@owenconti
owenconti / 5ec33e87e58ec.php
Created May 19, 2020 02:03
Using static HTTP redirects in Statamic v3
<?php
'redirect' => [
'/old' => 'https://some-external-url.com',
'/old-slug' => '/new-slug'
],
@owenconti
owenconti / 5ec33e4cacef8.html
Created May 19, 2020 02:02
Using CSS transforms with TailwindCSS v1.2
<div class="transform scale-50 rotate-45 translate-x-full origin-center"></div>
@owenconti
owenconti / 5ec33da2bce87.html
Created May 19, 2020 02:00
Building CSS Grids in TailwindCSS v1.2
<div class="grid grid-cols-2 lg:grid-cols-4 gap-6 w-full">
<div class="col-span-1 bg-red-500">Row 1, Column 1</div>
<div class="col-span-2 bg-blue-500">Row 1, Column 2, Span 2</div>
<div class="col-start-1 col-end-2 lg:col-start-2 lg:col-end-4 bg-green-500">Row 2, Start 2, End 4</div>
<div class="col-start-1 col-end-2 lg:col-end-4 bg-blue-500">Row 3, Start 1, End 4</div>
<div class="col-start-2 col-end-2 lg:col-end-5 bg-red-500">Row 4, Start 2, End 5</div>
</div>
@owenconti
owenconti / 5ec33d0e8bae2.js
Created May 19, 2020 01:57
Building CSS Grids in TailwindCSS v1.2
theme('spacing')