Skip to content

Instantly share code, notes, and snippets.

View sixlive's full-sized avatar

TJ Miller sixlive

View GitHub Profile
#!/usr/bin/env bash
script_name="$(basename "$0")"
_verify_dependencies() {
_print_err() {
printf "[$SCRIPT_NAME] \033[31m%s\033[0m\n" "$1"
}
if ! command -v gum &>/dev/null; then
@sixlive
sixlive / 0.demo.gif
Last active March 23, 2024 14:39
An interactive way to search pull requests and check them out
0.demo.gif
@sixlive
sixlive / init.lua
Created February 13, 2024 13:14
Window sizes
-- Define the map of applications and their default sizes
local appSizeMap = {
["Telegram"] = {{w=470, h=900}, {w=1160, h=710}},
["Todoist"] = {{w=635, h=920}, {w=1115, h=760}},
["Slack"] = {{w=1300, h=780}, {w=980, h=670}},
["WezTerm"] = {w=1357, h=920}
}
-- Store the current index of the size for each application
local appSizeIndex = {}
@sixlive
sixlive / 0.POST.md
Last active August 9, 2022 20:40
My Current PHP CS Fixer Workflow

This is the process and standard that I use for the vast majority of my Laravel code bases and projects.

For more information about php-cs-fixer visit the project repository: FriendsOfPHP/PHP-CS-FIXER.

Setup

Add the following .php_cs file to the root of your project.

.php_cs

@sixlive
sixlive / 0.POST.md
Last active August 31, 2017 19:40
Stackable Command Output

This is a little trait I use to stack output over the course of a command and display all the output at the end.

trait StackableOutput
{
    protected $stackedOutput = [];

    private function stackOutput($content, $type = 'line')
    {
 array_push($this->stackedOutput, [
@sixlive
sixlive / 0.POST.md
Last active August 29, 2017 12:49
Basic Resource Response Example

Here is a brief example/preview of the new Laravel 5.5 resource responses. Taylor will be going into much greater detail about this at the Laracon EU conference (2017).

Resource Response

{
  "data": {
    "id": "0b1a798c-7e7e-46d1-8c4c-0c786730d36f",
    "name": null,
    "status": "Ready"
@sixlive
sixlive / gistlog.yml
Last active February 10, 2020 18:14
My API Response "Standard"
published: true
@sixlive
sixlive / gistlog.yml
Last active August 24, 2017 14:12
Handy Shell Aliases and Functions
published: true
@sixlive
sixlive / blog.md
Last active September 13, 2017 17:07
How I typically build APIs

When I build an API I typically use a pretty simple format. It is actually pretty much Fractal out of the box by way of Spatie's Larave Fractal package. Personally, I've found other formats more verbose than I need. I've built some pretty robust APIs using this format without issue. I also rely heavily on sending status codes for request status and consumer notification.

When building an app that consumes the API I typically build SDKs. I've been using Apiary to document my APIs and you get a pretty nice tool set from them, making SDK generation and testing so much easier.

Response Examples

The responses were built using the following code:

routes/api.php

@sixlive
sixlive / Caddyfile
Created April 7, 2017 19:51 — forked from alexbilbie/Caddyfile
PHP-FPM Caddyfile example
root /app/public
tls /app/_docker/caddy/server.crt /app/_docker/caddy/server.key
fastcgi / php:9000 php
errors visible
rewrite {
regexp .*
ext /
to /index.php?{query}
}