Categories
Uncategorized

Updating Business Time VS Code theme

Go to project at /Code/themes/business-time

Update the version in package.json

run vsce publish

After a few minutes see it on the VS Code light theme marketplace

To update the Azure hosted git repo you’ll probably need a new Personal Access Token (PAT). Generate that in the UI, then you can use it as the password when using to that remote.

git push https://mike--healy@dev.azure.com/mike--healy/Themes/_git/Themes

But maybe the vsce publish command above is enough, and you don’t need to update the repo?

Categories
Uncategorized

Stripe Invoices

Settings (cog in top right) > Documents > Tax invoices are in there.

Categories
Uncategorized

MySQL for Developers Notes

From PlanetScale’s MySQL for Developers.

Strings

Charset defines what characters can go into a column.

SELECT * FROM information_schema.CHARACTER_SETS ORDER BY CHARACTER_SET_NAME;

A collation determines which characters are equal or greater in values in terms of sorting. e.g. is a == A or not? If not which is greater.

  • ai = accent insensitive
  • ci = case insensitive
Categories
Uncategorized

Search Tweet by Author

my search terms (from:mike_hasarms)
Categories
Uncategorized

Remove SSL from certbot

When you point a domain away from a server with Let’s Encrypt and Nginx tries to restart after SSL renewal it will fail. The domain IP link is broken, so you’ll get expired certs on unrelated sites.

To remove the SSL with certbot:

cd /opt/certbot
./certbot-auto certificates   //list existing certs
./certbot-auto delete --cert-name example.com

Categories
Uncategorized

Vue Testing Library didn’t work with Laravel

Broken code inside one of the dependencies of VTL, which I suspect is a conflict with the my versions of something else.

If I revisit it will try the Laracasts guide which uses the lower level library + manually pairing it with a test runner such as Jest.

Categories
Uncategorized

Don’t Write Your Own Tailwind

Creating some, but not enough, utility classes was a mistake. Should just use Tailwind, or not, but not half and half.

Categories
Uncategorized

S3 CLI Jobs

Move batch of files with a pattern. (Delete –dry-run to do it for real)

aws s3 mv s3://mybucket/path/ s3://mybucket/newpath/ --recursive --exclude "*" --include "my_pattern*.gz" --dryrun 

Find some objects with the deprecated Reduced Redundancy Storage type to migrate

aws s3api list-objects-v2 --bucket mybucket --max-item 200 --start-after "somepath" --query 'Contents[?StorageClass==`REDUCED_REDUNDANCY`][Key]'
Categories
Uncategorized

FFMPEG

Sequential still frames to video

ffmpeg -r 60 -f image2 -s 1920x1080 -i pic%04d.png -vcodec libx264 -crf 25  -pix_fmt yuv420p test.mp4

Where the %04d means that zeros will be padded until the length of the string is 4 i.e 0001…0020…0030…2000 and so on. If no padding is needed use something similar to pic%d.png or %d.png.

Resize video

scale is horizontal width. :-1 maintains ratio.

ffmpeg -i 2022-08_Mike-Dave.mp4 -filter:v scale=1920:-1 -c:a copy 2022-08_Mike-Dave_1080.mp4
Categories
Uncategorized

Patterns That Pay Off

Notes from Matt Stauffer’s talk.


/*
View Model
*/
class DashboardViewModel
{
    function topTasks()
    {
        $overdue = $this->overDueTasks();
        return array_merge($overdue, $this->fillTasksDueSoon( count($overdue) ));
    }

    function progressChart()
    {
        return [
            'complete' => $this->progressDone(),
            'date_markers' => $this->dateMarkers()
        ];
    }

}

return view('dashboard')->with('vm', new DashboardViewModel($user));

?>

View Data Composition

Presenter
    Layer above other thing, usually the model, to give it more powers.

View Model
    PHP Object for organizing this logic 

Responsable (sic)
    interface in Laravel for PHP object that can be converted to Response 

View Models

These seem fairly easy to understand. A class that wraps a model, providing methods for data access that a view will need. Moves the complexity of querying out of Controller.

And nicer than putting straight on model which complicates it in a lot of unrelated contexts.