copy snippets from mac

This commit is contained in:
Willem van den Ende
2025-10-10 10:21:45 +01:00
parent 934d5ecd36
commit 2bd933dced
19 changed files with 417 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
# key: ecto-seed
# name: Ecto seed table
# --
alias ${1:App}.${2:Context}
${3:instance}s = [
%{name: "Chess", description: "The classic strategy game", sku: 5_678_910, unit_price: 10.00},
%{
name: "Tic-Tac-Toe",
description: "The game of Xs and Os",
sku: 11_121_314,
unit_price: 3.00
},
%{
name: "Table tennis",
description: "Bat the ball bck and forth. Don't miss!",
sku: 15_222_324,
unit_price: 12.00
}
]
Enum.each($3s, fn $3->
$2.create_$3($3)
end)
$0
@@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: alter table migration
# key: alter-table
# --
alter table(:$1) do
add :$2, :$3
$0
end
+15
View File
@@ -0,0 +1,15 @@
# key: simple-form
# name: simple form
# --
<.simple_form>
:let={f}
for={@$1}
id="$2-form"
phx-change="validate"
phx-submit="save">
<.input field={@$1[:$3]} type="$4" label="$5" />
$0
<:actions>
<.button phx-disable-with="$6...">$7</.button>
</:actions>
</.simple_form>
+15
View File
@@ -0,0 +1,15 @@
# key: test-module
# name: test module
# condition: t
# --
defmodule $1.$2 do
import $3
use Pento.DataCase
describe "$3" do
test "$4" do
$0
assert false
end
end
end
@@ -0,0 +1,55 @@
# key: __codebuild.json
# name: AWS CodeBuild json config
# --
{
"name": "$1",
"arn": "arn:aws:codebuild:eu-central-1:123456789012:project/$2"
"description": "$3",
"source": {
"type": "CODEPIPELINE",
"insecureSsl": false
},
"secondarySourceVersions": [],
"artifacts": {
"type": "CODEPIPELINE",
"name": "$4",
"packaging": "NONE",
"encryptionDisabled": false
},
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/standard:5.0",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": [
{
"name": "AWS_DEFAULT_REGION",
"value": "eu-central-1",
"type": "PLAINTEXT"
}
],
"privilegedMode": true,
"imagePullCredentialsType": "CODEBUILD"
},
"serviceRole": "arn:aws:iam::123456789012:role/ExampleCodeBuildServiceRole",
"timeoutInMinutes": 60,
"queuedTimeoutInMinutes": 480,
"encryptionKey": "arn:aws:kms:eu-central-1:123456789012:alias/aws/s3",
"tags": [$5],
"badge": {
"badgeEnabled": false
},
"logsConfig": {
"cloudWatchLogs": {
"status": "ENABLED"
},
"s3Logs": {
"status": "DISABLED",
"encryptionDisabled": false
}
},
"fileSystemLocations": [],
"concurrentBuildLimit": 1
}
+55
View File
@@ -0,0 +1,55 @@
# key: __codebuild.json
# name: AWS CodeBuild json config
# --
{
"name": "course-vendingmachine-cs",
"arn": "arn:aws:codebuild:eu-central-1:123456789012:project/$1"
"description": "$2",
"source": {
"type": "CODEPIPELINE",
"insecureSsl": false
},
"secondarySourceVersions": [],
"artifacts": {
"type": "CODEPIPELINE",
"name": "$3",
"packaging": "NONE",
"encryptionDisabled": false
},
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/standard:5.0",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": [
{
"name": "AWS_DEFAULT_REGION",
"value": "eu-central-1",
"type": "PLAINTEXT"
}
],
"privilegedMode": true,
"imagePullCredentialsType": "CODEBUILD"
},
"serviceRole": "arn:aws:iam::123456789012:role/ExampleCodeBuildServiceRole",
"timeoutInMinutes": 60,
"queuedTimeoutInMinutes": 480,
"encryptionKey": "arn:aws:kms:eu-central-1:123456789012:alias/aws/s3",
"tags": [$4],
"badge": {
"badgeEnabled": false
},
"logsConfig": {
"cloudWatchLogs": {
"status": "ENABLED"
},
"s3Logs": {
"status": "DISABLED",
"encryptionDisabled": false
}
},
"fileSystemLocations": [],
"concurrentBuildLimit": 1
}
+12
View File
@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: jekyll blog post
# key: jekyll_post
# --
---
layout: post
title: $0
tags:
- $1
author: Willem van den Ende
image: $2
---
@@ -0,0 +1,12 @@
# -*- mode: snippet -*-
# name: jekyll call to action - training
# key: cta
# --
<aside>
<h3>${1:title}</h3>
<p>${2:description}
<p></p>
<div>
<a href="/training">${3:action}</a>
</div>
</aside>
@@ -0,0 +1,19 @@
# -*- mode: snippet -*-
# name: PlantUML Sequence diagram
# key: plantuml_sequence
# --
#+begin_src plantuml :file $0.png
@startuml
skinparam {
handwritten true
monochrome true
}
$1 -> Service: message(value)
Service -> Inside
Service --> $1: success(value)
Inside --> Service: success(value)
@enduml
#+end_src
+11
View File
@@ -0,0 +1,11 @@
# key: graphviz
# name: graphviz directed graph
# --
#+begin_src dot :file ${1:file}.png :cmdline -T${2:png} :exports none :results silent
`%`$0
digraph G {
a -> b [label=" a to b"]
}
#+end_src
[[file:$1]]
+10
View File
@@ -0,0 +1,10 @@
# -*- mode: snippet -*-
# name: new llm call in orgmode
# uuid:
# key: llm
# condition: t
# --
#+BEGIN_SRC bash :results verbatim
llm prompt -m mlx-community/Qwen2.5-Coder-32B-Instruct-8bit '$0'
#+END_SRC
@@ -0,0 +1,38 @@
# -*- mode: snippet -*-
# name: plantuml class and package diagram
# key: plantuml-package
# --
#+begin_src plantuml :file vending-domain-package.png
@startuml embedded-machine
skinparam {
handwritten true
monochrome true
}
package $0 {
together {
class $1 {
$2($3: $4)
}
class Display {
show_message(message: str)
}
}
class Drawer {
deliver()
}
class Button {
push()
}
class CashRegister {
insert(coins: int)
checkout(price: int)
}
Button -> Drawer
Drawer --> CashRegister
Drawer --> Bin
CashRegister --> Display
Bin --> Display
}
@enduml
#+end_src
+31
View File
@@ -0,0 +1,31 @@
# -*- mode: snippet -*-
# name: plantuml state diagram
# key: stateDiagram
# --
#+begin_src plantuml
@startuml
[*] --> CheckingValidity
CheckingValidity: is valid [[roam:JSON]]
CheckingValidity --> [*] : fail
CheckingValidity -> ParsingAllFields
state ParsingAllFields {
ParsingFields : type
ParsingFields : attributes
ParsingFields : validations
ParsingFields : messages
ParsingFields : composite
ParsingFields -> ParsingCompositeField : composite
ParsingCompositeField : recursive ParsingFields
ParsingCompositeField : validations of combined part values
ParsingFields -> ParsingField : part
}
ParsingAllFields -> FindingLinks: FormDefinition
ParsingAllFields -> [*] : fail
FindingLinks --> [*]: not found
FindingLinks : conditional show
FindingLinks : none
FindingLinks -> RenderingFields: Enriched FormDefinition
RenderingFields --> [*]: success
@enduml
#+end_src
+11
View File
@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: builder method
# key: with_attribute_build
# --
pub(crate) fn with_${1:attributename}(&mut self, $1: &str) -> &${2:structname} {
self.$1 = $1.to_string();
return self;
}
$0
@@ -0,0 +1,11 @@
# -*- mode: snippet -*-
# name: builder method with T Clonable
# key: with_attribute_t_clone
# --
pub(crate) fn with_${1:attributename}(&mut self, $1: &${2:Type}) -> &${3:structname} {
self.$1 = $1.clone();
return self;
}
$0
+44
View File
@@ -0,0 +1,44 @@
# key: thenewtype
# name: new purescript newtype in its' own module
# --
# in 'text-mode' because purescript-mode generates parse error
module ${1:ModulePrefix}.${2:NewTypeName} (
$2(..)
, aDummy
) where
import Data.Firebase.Foreign (class ToFirebaseForeign)
import Data.Foreign (toForeign, readString)
import Data.Foreign.Class (class IsForeign)
import Data.Generic (class Generic, gCompare, gEq, gShow)
import Test.QuickCheck.Arbitrary (class Arbitrary, arbitrary)
import Prelude (class Eq, class Ord, class Show, ($),bind, pure)
import UReview.Prelude (readForeign)
newtype $2 = $2 {${4:fieldName}:: ${5:Type}}
aDummy :: $2
aDummy = $2 {$4: "$6"}
derive instance generic$2 :: Generic $2
instance show$2 :: Show $2 where
show = gShow
instance eq$2 :: Eq $2 where
eq = gEq
instance ord$2 :: Ord $2 where
compare = gCompare
instance arb$2 :: Arbitrary $2 where
arbitrary = do
$4 <- arbitrary
pure ($2 {$4 })
instance isForeign$2 :: IsForeign $2 where
read fo = readForeign fo
instance toFirebaseForeign$2 :: ToFirebaseForeign $2
where toFire = ${7:conversionFn} >>> toForeign
$0
+8
View File
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: plantuml handwritten
# key: handwritten_plantuml
# --
skinparam {
handwritten true
monochrome true
}
+28
View File
@@ -0,0 +1,28 @@
# -*- mode: yaml -*-
# name: AWS CodeBuild buildspec
# key: buildspec
# --
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.eu-central-1.amazonaws.com
- REPOSITORY_URI=123456789012.dkr.ecr.eu-central-1.amazonaws.com/example/$1
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
+7
View File
@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: .aider.conf.yml starting point
# uuid:
# key: aider_config
# condition: t
# --
read: [CONVENTIONS.md]