From 2bd933dced948c01ebc65762906b1746fced64fe Mon Sep 17 00:00:00 2001 From: Willem van den Ende Date: Fri, 10 Oct 2025 10:21:45 +0100 Subject: [PATCH] copy snippets from mac --- snippets/elixir-mode/Ecto seed table | 26 +++++++++ snippets/elixir-mode/alter table migration | 9 +++ snippets/elixir-mode/simple form | 15 +++++ snippets/elixir-mode/test module | 15 +++++ snippets/json-mode/AWS CodeBuild json config | 55 +++++++++++++++++++ snippets/json-mode/__code_build.json | 55 +++++++++++++++++++ snippets/markdown-mode/jekyll blog post | 12 ++++ .../jekyll call to action - training | 12 ++++ snippets/org-mode/PlantUML Sequence diagram | 19 +++++++ snippets/org-mode/graphviz_directed_graph | 11 ++++ snippets/org-mode/llm | 10 ++++ .../plantuml class and package diagram | 38 +++++++++++++ snippets/org-mode/plantuml state diagram | 31 +++++++++++ snippets/rustic-mode/builder method | 11 ++++ .../builder method with T Clonable | 11 ++++ snippets/text-mode/newtype | 44 +++++++++++++++ snippets/text-mode/plantuml handwritten | 8 +++ snippets/yaml-mode/___buildspec.yml | 28 ++++++++++ snippets/yaml-mode/aider_config | 7 +++ 19 files changed, 417 insertions(+) create mode 100644 snippets/elixir-mode/Ecto seed table create mode 100644 snippets/elixir-mode/alter table migration create mode 100644 snippets/elixir-mode/simple form create mode 100644 snippets/elixir-mode/test module create mode 100644 snippets/json-mode/AWS CodeBuild json config create mode 100644 snippets/json-mode/__code_build.json create mode 100644 snippets/markdown-mode/jekyll blog post create mode 100644 snippets/markdown-mode/jekyll call to action - training create mode 100644 snippets/org-mode/PlantUML Sequence diagram create mode 100644 snippets/org-mode/graphviz_directed_graph create mode 100644 snippets/org-mode/llm create mode 100644 snippets/org-mode/plantuml class and package diagram create mode 100644 snippets/org-mode/plantuml state diagram create mode 100644 snippets/rustic-mode/builder method create mode 100644 snippets/rustic-mode/builder method with T Clonable create mode 100644 snippets/text-mode/newtype create mode 100644 snippets/text-mode/plantuml handwritten create mode 100644 snippets/yaml-mode/___buildspec.yml create mode 100644 snippets/yaml-mode/aider_config diff --git a/snippets/elixir-mode/Ecto seed table b/snippets/elixir-mode/Ecto seed table new file mode 100644 index 0000000..9072330 --- /dev/null +++ b/snippets/elixir-mode/Ecto seed table @@ -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 \ No newline at end of file diff --git a/snippets/elixir-mode/alter table migration b/snippets/elixir-mode/alter table migration new file mode 100644 index 0000000..8748d61 --- /dev/null +++ b/snippets/elixir-mode/alter table migration @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: alter table migration +# key: alter-table +# -- + +alter table(:$1) do + add :$2, :$3 + $0 +end \ No newline at end of file diff --git a/snippets/elixir-mode/simple form b/snippets/elixir-mode/simple form new file mode 100644 index 0000000..29f686b --- /dev/null +++ b/snippets/elixir-mode/simple form @@ -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 + + diff --git a/snippets/elixir-mode/test module b/snippets/elixir-mode/test module new file mode 100644 index 0000000..90989b1 --- /dev/null +++ b/snippets/elixir-mode/test module @@ -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 diff --git a/snippets/json-mode/AWS CodeBuild json config b/snippets/json-mode/AWS CodeBuild json config new file mode 100644 index 0000000..91a8b94 --- /dev/null +++ b/snippets/json-mode/AWS CodeBuild json config @@ -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 +} \ No newline at end of file diff --git a/snippets/json-mode/__code_build.json b/snippets/json-mode/__code_build.json new file mode 100644 index 0000000..31ddf75 --- /dev/null +++ b/snippets/json-mode/__code_build.json @@ -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 +} \ No newline at end of file diff --git a/snippets/markdown-mode/jekyll blog post b/snippets/markdown-mode/jekyll blog post new file mode 100644 index 0000000..eaaa81c --- /dev/null +++ b/snippets/markdown-mode/jekyll blog post @@ -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 +--- \ No newline at end of file diff --git a/snippets/markdown-mode/jekyll call to action - training b/snippets/markdown-mode/jekyll call to action - training new file mode 100644 index 0000000..0cfd320 --- /dev/null +++ b/snippets/markdown-mode/jekyll call to action - training @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: jekyll call to action - training +# key: cta +# -- + diff --git a/snippets/org-mode/PlantUML Sequence diagram b/snippets/org-mode/PlantUML Sequence diagram new file mode 100644 index 0000000..7e8ce57 --- /dev/null +++ b/snippets/org-mode/PlantUML Sequence diagram @@ -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 \ No newline at end of file diff --git a/snippets/org-mode/graphviz_directed_graph b/snippets/org-mode/graphviz_directed_graph new file mode 100644 index 0000000..94de1df --- /dev/null +++ b/snippets/org-mode/graphviz_directed_graph @@ -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]] diff --git a/snippets/org-mode/llm b/snippets/org-mode/llm new file mode 100644 index 0000000..72cb95b --- /dev/null +++ b/snippets/org-mode/llm @@ -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 diff --git a/snippets/org-mode/plantuml class and package diagram b/snippets/org-mode/plantuml class and package diagram new file mode 100644 index 0000000..9dca50b --- /dev/null +++ b/snippets/org-mode/plantuml class and package diagram @@ -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 diff --git a/snippets/org-mode/plantuml state diagram b/snippets/org-mode/plantuml state diagram new file mode 100644 index 0000000..be51f4b --- /dev/null +++ b/snippets/org-mode/plantuml state diagram @@ -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 \ No newline at end of file diff --git a/snippets/rustic-mode/builder method b/snippets/rustic-mode/builder method new file mode 100644 index 0000000..e2eb829 --- /dev/null +++ b/snippets/rustic-mode/builder method @@ -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 \ No newline at end of file diff --git a/snippets/rustic-mode/builder method with T Clonable b/snippets/rustic-mode/builder method with T Clonable new file mode 100644 index 0000000..926f01a --- /dev/null +++ b/snippets/rustic-mode/builder method with T Clonable @@ -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 \ No newline at end of file diff --git a/snippets/text-mode/newtype b/snippets/text-mode/newtype new file mode 100644 index 0000000..8b72313 --- /dev/null +++ b/snippets/text-mode/newtype @@ -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 \ No newline at end of file diff --git a/snippets/text-mode/plantuml handwritten b/snippets/text-mode/plantuml handwritten new file mode 100644 index 0000000..8b1af28 --- /dev/null +++ b/snippets/text-mode/plantuml handwritten @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: plantuml handwritten +# key: handwritten_plantuml +# -- +skinparam { +handwritten true +monochrome true +} diff --git a/snippets/yaml-mode/___buildspec.yml b/snippets/yaml-mode/___buildspec.yml new file mode 100644 index 0000000..e6d9720 --- /dev/null +++ b/snippets/yaml-mode/___buildspec.yml @@ -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 diff --git a/snippets/yaml-mode/aider_config b/snippets/yaml-mode/aider_config new file mode 100644 index 0000000..27458a6 --- /dev/null +++ b/snippets/yaml-mode/aider_config @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: .aider.conf.yml starting point +# uuid: +# key: aider_config +# condition: t +# -- +read: [CONVENTIONS.md]