Skip to content

Commit 77bdc72

Browse files
committed
remove useless snips + prettify css json md and yaml
1 parent 8651feb commit 77bdc72

File tree

2 files changed

+6
-225
lines changed

2 files changed

+6
-225
lines changed

UltiSnips/php.snippets

Lines changed: 0 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -1,232 +1,7 @@
1-
snippet ld "Ladybug Dump" b
2-
ld($${1:var});
3-
endsnippet
4-
5-
snippet ldd "Ladybug Dump Die" b
6-
ldd($${1:var});
7-
endsnippet
8-
91
snippet atoum "atoum bootstrap" b
102
$this
113
->given($this->newTestedInstance)
124
->then
135
->${1}
146
;
157
endsnippet
16-
17-
18-
snippet rest_controller "FOS Rest controller" b
19-
<?php
20-
21-
namespace Mapado\TicketingBundle\Controller;
22-
23-
use FOS\RestBundle\Controller\Annotations as Rest;
24-
use InvalidArgumentException;
25-
use Mapado\TicketingBundle\Entity\\${1:ClassName};
26-
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
27-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
28-
use Symfony\Component\HttpFoundation\Request;
29-
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
30-
31-
/**
32-
* Class $1Controller
33-
* @author Julien Deniau <[email protected]>
34-
*
35-
* @Rest\RouteResource("$1")
36-
*/
37-
class $1Controller extends FOSRestBaseController
38-
{
39-
/**
40-
* cgetAction
41-
*
42-
* @access public
43-
* @return Response
44-
*
45-
* @ApiDoc(
46-
* resource=true,
47-
* section="$1",
48-
* description="Get a $1",
49-
* requirements={
50-
* {"name"="id", "description"="$1 id", "dataType"="int"}
51-
* }
52-
* )
53-
*
54-
* @Rest\Get("/${2:underscore_case}s", defaults={"_resource": "$1"})
55-
*
56-
* @Rest\QueryParam(name="itemsPerPage", requirements="\d+", strict=true, nullable=true, description="Item count limit")
57-
* @Rest\QueryParam(name="page", requirements="\d+", strict=true, nullable=true, description="Page to fetch")
58-
*
59-
* @ParamConverter("page")
60-
* @ParamConverter("itemsPerPage")
61-
*/
62-
public function cgetAction(Request $request, $page, $itemsPerPage)
63-
{
64-
if (!$this->get('api_authorization_checker')->isGrantedAccess($request)) {
65-
throw $this->createAccessDeniedException('forbidden');
66-
}
67-
68-
$queryBuilder = $this->get('mapado_ticketing.repository.$2')
69-
->createQueryBuilder('${3:qbAlias}');
70-
71-
$this->applyFilters($1::class, $queryBuilder, $request);
72-
73-
$data = $this->getPaginatedData($queryBuilder, $itemsPerPage, $page);
74-
75-
$view = $this->view($data);
76-
77-
return $this->handleView($view);
78-
}
79-
80-
/**
81-
* getAction
82-
*
83-
* @access public
84-
* @return Response
85-
*
86-
* @ApiDoc(
87-
* resource=true,
88-
* section="$1",
89-
* description="Get a $1",
90-
* requirements={
91-
* {"name"="id", "description"="$1 id", "dataType"="int"}
92-
* }
93-
* )
94-
*
95-
* @Rest\Get("/$2s/{id}", defaults={"_resource": "$1"})
96-
*
97-
* @ParamConverter(
98-
* "${4:snakeCase}",
99-
* class="Mapado\TicketingBundle\Entity\\$1",
100-
* options={"mapping" = {"id" = "id"}, "entity_manager" = "default"}
101-
* )
102-
*/
103-
public function getAction($1 $$4)
104-
{
105-
$view = $this->view($$4);
106-
107-
return $this->handleView($view);
108-
}
109-
110-
/**
111-
* putAction
112-
*
113-
* @access public
114-
* @return Response
115-
*
116-
* @ApiDoc(
117-
* resource=true,
118-
* section="$1",
119-
* description="Update a $1",
120-
* requirements={
121-
* {"name"="id", "description"="$1 id", "dataType"="int"}
122-
* }
123-
* )
124-
*
125-
* @Rest\Put("/$2s/{id}", defaults={"_resource": "$1"})
126-
*/
127-
public function putAction()
128-
{
129-
try {
130-
$$4 = $this->get('mapado.json_ld_handler')
131-
->deserializeFromRequest('Mapado\TicketingBundle\Entity\\$1');
132-
} catch (InvalidArgumentException $e) {
133-
throw new BadRequestHttpException($e->getMessage(), $e);
134-
}
135-
136-
if (!$this->get('api_authorization_checker')->isGrantedEdit($$4, $this->getUser())) {
137-
throw $this->createAccessDeniedException('forbidden');
138-
}
139-
140-
$this->get('doctrine.orm.entity_manager')->flush();
141-
$view = $this->view($$4);
142-
143-
return $this->handleView($view);
144-
}
145-
146-
/**
147-
* postAction
148-
*
149-
* @access public
150-
* @return Response
151-
*
152-
* @ApiDoc(
153-
* resource=true,
154-
* section="$1",
155-
* description="Create a $1"
156-
* )
157-
*
158-
* @Rest\Post("/$2s", defaults={"_resource": "$1"})
159-
*/
160-
public function postAction()
161-
{
162-
try {
163-
$$4 = $this->get('mapado.json_ld_handler')
164-
->deserializeFromRequest('Mapado\TicketingBundle\Entity\\$1');
165-
} catch (InvalidArgumentException $e) {
166-
throw new BadRequestHttpException($e->getMessage(), $e);
167-
}
168-
169-
if (!$this->get('api_authorization_checker')->isGrantedEdit($$4, $this->getUser())) {
170-
throw $this->createAccessDeniedException('forbidden');
171-
}
172-
173-
$entityManager = $this->get('doctrine.orm.entity_manager');
174-
175-
$entityManager->persist($$4);
176-
$entityManager->flush();
177-
178-
$view = $this->view($$4, 201);
179-
180-
return $this->handleView($view);
181-
}
182-
183-
/**
184-
* deleteAction
185-
*
186-
* @access public
187-
* @return Response
188-
*
189-
* @ApiDoc(
190-
* resource=true,
191-
* section="$1",
192-
* description="Delete a $1",
193-
* requirements={
194-
* {"name"="id", "description"="$1 id", "dataType"="int"}
195-
* }
196-
* )
197-
*
198-
* @Rest\Delete("/$2s/{id}", defaults={"_resource": "$1"})
199-
*
200-
* @ParamConverter(
201-
* "$4",
202-
* class="Mapado\TicketingBundle\Entity\\$1",
203-
* options={"mapping" = {"id" = "id"}, "entity_manager" = "default"}
204-
* )
205-
*/
206-
public function deleteAction($1 $$4)
207-
{
208-
if (!$this->get('api_authorization_checker')->isGrantedEdit($$4, $this->getUser())) {
209-
throw $this->createAccessDeniedException('forbidden');
210-
}
211-
212-
$entityManager = $this->get('doctrine.orm.entity_manager');
213-
$entityManager->remove($$4);
214-
$entityManager->flush();
215-
216-
return $this->handleView($this->view(null, 204));
217-
}
218-
${5:
219-
220-
/**
221-
* getFilterList
222-
*
223-
* @access protected
224-
* @return array
225-
*/
226-
protected function getFilterList() : array
227-
{
228-
return [];
229-
}
230-
}
231-
}
232-
endsnippet

init.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ set foldcolumn=1
202202
autocmd FileType c,cpp,java,go,php,javascript,python,twig,xml,yml autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') | call StripTrailingWhitespace() | endif
203203
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
204204
autocmd BufNewFile,BufRead *.svg.twig set filetype=svg.twig
205+
autocmd BufNewFile,BufRead *.neon,.yamllint set filetype=yaml
205206
autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
206207
autocmd FileType php autocmd BufWritePre <buffer> call PhpSortUse()
207208
" let g:php_namespace_sort_after_insert = 1
@@ -640,12 +641,17 @@ highlight ShowMarksHLm gui=bold guibg=grey30
640641
"
641642

642643
" let g:ale_lint_on_enter = 1
644+
let g:ale_sign_column_always = 1
643645
let g:ale_fix_on_save = 1
644646
" let g:ale_set_loclist = 0
645647
" let g:ale_set_quickfix = 1
646648
let g:ale_open_list = 0
647649
let g:ale_fixers = {
650+
\ 'css': [ 'prettier' ],
651+
\ 'json': [ 'prettier' ],
652+
\ 'markdown': [ 'prettier' ],
648653
\ 'javascript': [ 'prettier' ],
654+
\ 'yaml': [ 'prettier' ],
649655
\ 'php': [ 'php_cs_fixer' ],
650656
\}
651657
let g:ale_linters = {

0 commit comments

Comments
 (0)