Skip to content

Instantly share code, notes, and snippets.

View owenvoke's full-sized avatar

Owen Voke owenvoke

View GitHub Profile
#!/usr/bin/env bash
# Check that the GitHub token is set
# See: https://github.com/settings/tokens
if [ -z ${GITHUB_TOKEN} ]; then
echo "The 'GITHUB_TOKEN' environment variable must be set."
exit
fi
# Check that all required binaries are installed
#!/usr/bin/env bash
# Usage: ./import-bare-repos-to-gitea {{base_uri}} {{user_id}} {{access_token}} {{import_path}}
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ]; then
echo "Usage: ./import-bare-repos-to-gitea {{base_uri}} {{user_id}} {{access_token}} {{import_path}}"
exit
fi
# Gitea base URI
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
/**
* A command that handles IDE helper generation of helper file and PHPStorm metadata against platform environment.
* This command performs these actions in development environment, else it does nothing, but does not crash the project.
*
#
# Starship Zplug
# https://github.com/starship/starship
#
# Add the following to your ".zshrc":
# zplug "pxgamer/9070c3dbd6483d69a4b376f9dbcb9e62", use:starship.zsh, from:gist, as:theme
export STARSHIP_VERSION='0.26.4'
STARSHIP_LATEST_RELEASE=https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz
@owenvoke
owenvoke / LaravelZeroTinkerwellDriver.php
Created February 28, 2020 09:55
A Tinkerwell driver for Laravel Zero.
<?php
use LaravelZero\Framework\Application;
use Tinkerwell\ContextMenu\Label;
use Tinkerwell\ContextMenu\Submenu;
use Tinkerwell\ContextMenu\SetCode;
use Tinkerwell\ContextMenu\OpenURL;
class LaravelZeroTinkerwellDriver extends TinkerwellDriver
{
@owenvoke
owenvoke / Tall Stack Pest Syntax.md
Last active June 10, 2020 16:24
A patch for updating the TALL stack preset tests to use Pest syntax.

Tall Stack Pest Syntax

This is a patch for updating the Laravel TALL stack preset tests to use the Pest syntax.

Usage

curl https://gist.githubusercontent.com/owenvoke/b9e09290fe55737be8168c9d961a772f/raw/tall-stack-pest-syntax-changes.diff | git apply
@owenvoke
owenvoke / Dockerfile
Created September 30, 2020 12:55
A Dockerfile for Laravel Zero PHAR distribution
# Set the required PHP version
FROM php:7.3-cli
# Set the name of your application binary
ARG APP_NAME=application
# Update global packages for the container
RUN apt-get update
# Install any required PHP extensions
@owenvoke
owenvoke / DragonCommand.php
Created September 30, 2020 15:56
Display the Laravel Dragon ASCII art
<?php
namespace App\Commands;
use Illuminate\Console\Command;
class DragonCommand extends Command
{
/** {@inheritdoc} */
protected $signature = 'dragon';
@owenvoke
owenvoke / readDuration.php
Created May 5, 2021 10:17
A string macro for the duration to read text.
<?php
// From Marcel Pociot's tweet
// See: https://twitter.com/marcelpociot/status/1389881758267625473
Str::macro('readDuration', function (... $text) {
$totalWords = str_word_count(implode(' ', $text));
$minutesToRead = round($totalWords / 200);
return (int) max(1, $minutesToRead);