adding some various snippets

This commit is contained in:
Brian 2022-05-18 09:21:29 -06:00
parent 5d2ef15f59
commit 1bc953bc44
Signed by: brian
GPG Key ID: DE1A5390A3B84CD8
4 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<snippet>
<content><![CDATA[
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
-
### Changed
-
### Removed
-
## [1.0.0] - 20XX-01-01
### Added
-
### Changed
-
### Removed
-
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>changelog</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>

View File

@ -0,0 +1,20 @@
<snippet>
<content><![CDATA[
<img alt="alt text"
loading="lazy"
decoding="async"
height="1080"
width="1920"
srcset="${1:some_image}_sd_640.jpg?w=50&fm=jpg&fl=progressive 640w,
${1:some_image}_hd_720.jpg?w=100&fm=jpg&fl=progressive 720w,
${1:some_image}_hd_1920.jpg?w=200&fm=jpg&fl=progressive 1920w"
sizes="(max-width: 640px) 640px,
(max-width: 720px) 720px,
1920px"
src="${1:some_image}_hd_1920.jpg">
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>img</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>

View File

@ -0,0 +1,53 @@
<snippet>
<content><![CDATA[
<?php
namespace App\Models\Traits;
trait HasUidTrait
{
/**
* Ensure that when a model is saving, a unique ID
* is set for the model.
*
* @since 1.0.0
*
* @return void
*/
public static function bootHasUidTrait()
{
//
}
/**
* Initialize logic.
*
* @since 1.0.0
*
* @return void
*/
protected function initializeHasUidTrait(): void
{
\$this->id = \$this->generateUid();
}
/**
* Generates a cryptographically safe unique ID.
*
* @since 1.0.0
*
* @return string
*/
public function generateUid(): string
{
\$bytes = openssl_random_pseudo_bytes(env('APP_UID_BYTES', 8));
return bin2hex(\$bytes);
}
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>hasuid</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>

View File

@ -0,0 +1,9 @@
<snippet>
<content><![CDATA[
preserveAspectRatio="xMidYMid meet"
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>preserveAspect</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>