Skip to content

Instantly share code, notes, and snippets.

@alnutile
alnutile / session
Created November 25, 2023 19:29
session inertia
request()->session()->flash('flash.banner', 'Message sent, Thank you!');
<?php
namespace App\Services;
use Spatie\Tags\Tag;
use Ramsey\Uuid\Uuid;
use App\Models\Recall;
use App\Tagging\Subscribables;
use Illuminate\Database\Eloquent\Model;
use Google\Cloud\Firestore\FirestoreClient;
@alnutile
alnutile / coverage-checker.php
Created January 1, 2019 11:50
Code Coverage Checker
<?php
// coverage-checker.php
//https://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/
$inputFile = $argv[1];
$percentage = min(100, max(0, (int) $argv[2]));
if (!file_exists($inputFile)) {
throw new InvalidArgumentException('Invalid input file provided');
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
<?php
namespace Alnutile\Example;
class SkeletonClassTest extends TestCase
{
/**
* Test that true does in fact equal true
*/
public function testTrueIsTrue()
<?php
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
load_dotenv();
<?php
define('COMMAND_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
@alnutile
alnutile / command.php
Last active June 17, 2017 00:33
Code for Medium post on CLI Skel
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
---
- name: Create Oauth Keys
become: yes
become_user: catuser
command: php /home/{{ user }}/app/artisan passport:keys --quiet
ignore_errors: true
- name: Install for s3 module
pip:
name: boto
<style scoped>
.action-link {
cursor: pointer;
}
.m-b-none {
margin-bottom: 0;
}
</style>