summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick de Vries <diederick@diederickdevries.net>2020-05-06 21:41:17 +0200
committerDiederick de Vries <diederick@diederickdevries.net>2020-05-06 21:41:17 +0200
commit94779b83e2e8e72323651d6a94bbf15dd3adc864 (patch)
treebb1adfe0ea9bdd7e77025944c27dd611e9c4c07c
parentf5bb2c252eeb2d5718a0857c7f2a5eec8cd89076 (diff)
downloadvimrc-94779b83e2e8e72323651d6a94bbf15dd3adc864.tar.gz
vimrc-94779b83e2e8e72323651d6a94bbf15dd3adc864.tar.bz2
vimrc-94779b83e2e8e72323651d6a94bbf15dd3adc864.zip
feature: add more templates
-rw-r--r--skeletons/gplintro.txt18
-rw-r--r--skeletons/restget.java12
-rw-r--r--skeletons/restpost.java12
-rw-r--r--vimrc.d/snippets.vim3
4 files changed, 45 insertions, 0 deletions
diff --git a/skeletons/gplintro.txt b/skeletons/gplintro.txt
new file mode 100644
index 0000000..ec8a064
--- /dev/null
+++ b/skeletons/gplintro.txt
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2020-2020 Diederick de Vries <diederick@diederickdevries.net>
3 *
4 * This file is part of PROJECT.
5 *
6 * PROJECT is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PROJECT is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PROJECT. If not, see <http://www.gnu.org/licenses/>.
18 */
diff --git a/skeletons/restget.java b/skeletons/restget.java
new file mode 100644
index 0000000..38a9791
--- /dev/null
+++ b/skeletons/restget.java
@@ -0,0 +1,12 @@
1@RequestMapping(value = "/get/{id}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
2public ResponseEntity<Object> get(@PathVariable final Integer id)
3{
4 Optional<Item> optionalItem = itemRepository.findById(id);
5 if (!optionalItem.isPresent())
6 {
7 return ResponseEntity
8 .status(HttpStatus.NOT_FOUND)
9 .body(MessageUtil.parse(MSG_404_ITEM, id + ""));
10 }
11 return ResponseEntity.ok(optionalItem.get());
12}
diff --git a/skeletons/restpost.java b/skeletons/restpost.java
new file mode 100644
index 0000000..d4f8724
--- /dev/null
+++ b/skeletons/restpost.java
@@ -0,0 +1,12 @@
1@RequestMapping(value = "/edit", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
2public ResponseEntity<Object> edit(final Integer id, final String value)
3{
4 Optional<Item> optionalItem = itemRepository.findById(id);
5 if (!optionalItem.isPresent())
6 {
7 return ResponseEntity
8 groceryRepository.saveAndFlush(item.getGrocery());
9 itemRepository.saveAndFlush(item);
10
11 return ResponseEntity.ok(item.getFormatted());
12}
diff --git a/vimrc.d/snippets.vim b/vimrc.d/snippets.vim
index 6115654..2c585df 100644
--- a/vimrc.d/snippets.vim
+++ b/vimrc.d/snippets.vim
@@ -1 +1,4 @@
1nnoremap ,html :-1read $HOME/.vim/skeletons/skeleton.html<CR>2jwf>a 1nnoremap ,html :-1read $HOME/.vim/skeletons/skeleton.html<CR>2jwf>a
2nnoremap ,gpl :-1read $HOME/.vim/skeletons/gplintro.txt<CR>jf22lR
3nnoremap ,get :-1read $HOME/.vim/skeletons/restget.java<CR>3j^
4nnoremap ,post :-1read $HOME/.vim/skeletons/restpost.java<CR>3j^