This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "articles": [ | |
| { | |
| "id": 1, | |
| "title": "Quando não usar isset e empty na mesma condição" | |
| }, | |
| { | |
| "id": 2, | |
| "title": "Implementando jQuery de maneira organizada" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from customers; | |
| -- O valor dado no registro é aplicado aos registros já existentes ao adicionar uma nova coluna à tabela | |
| alter table customers | |
| add level int default 1; | |
| insert into customers (first_name, last_name, gender) | |
| values ('Primeire', 'Teste', 'O'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "php.suggest.basic": false, | |
| "workbench.editor.enablePreview": false, | |
| "workbench.editor.enablePreviewFromQuickOpen": false, | |
| "editor.fontSize": 19, | |
| "markdown.preview.lineHeight": 1.61, | |
| "editor.lineHeight": 38, | |
| "workbench.iconTheme": "material-icon-theme", | |
| "editor.fontFamily": "Iosevka SS06 Semibold", | |
| "editor.letterSpacing": 0.5, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir generated_docs | |
| apidoc -i . -o generated_docs | |
| mv generated_docs/api_data.json . | |
| mv generated_docs/api_project.json . | |
| rm -rf generated_docs | |
| apidoc-markdown -p . -o doc-markdown.md | |
| rm api_data.json | |
| rm api_project.json | |
| code doc-markdown.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function () { | |
| // "Subi" o código chamado na inicialização. | |
| // Separei o ajax da lista em outro método para remover a duplicação. | |
| obtemLista(); | |
| $('.button-links').click(function () { | |
| // Atribuí o link à uma variável para o caso de utilizar novamente, além de facilitar a leitura do código. | |
| var link = $('this').attr('link'); | |
| // Adicionei a mesma classe para todos os links alterados por esse evento. | |
| $('.link-list').text(link); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function () { | |
| $('.button-links').click(function () { | |
| // Mesmo código sendo executado mais de uma vez para popular mais de um link. | |
| $('.link1').text($('this').attr('link')); | |
| $('.link2').text($('this').attr('link')); | |
| $('.link3').text($('this').attr('link')); | |
| }); | |
| // Seletor baseado no tipo dos elementos, e não em suas classes. | |
| // O ideal é criar uma classe para cada comportamento / evento. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import componentB from './z-component-b'; | |
| export default { | |
| state: {}, | |
| elements: {}, | |
| initialize() { | |
| ... | |
| }, | |
| initializeElements() { | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Como usar: | |
| * Importe este objeto e chame o método initialize: | |
| * import seuObjeto as './<CAMINHO-APARA-O-ARQUIVO>/<ARQUIVO>.js'; | |
| * seuObjeto.initialize(); | |
| * | |
| * /!\ Sempre inicialize um componente depois que sua página tenha sido carregada, | |
| * dentro de um $(document).ready(() => {}), por exemplo. | |
| * De forma encurtada: $(() => {}). /!\ | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import myComponent from './components/my-component'; | |
| (($) => { | |
| $(() => { | |
| myComponent.initialize(); | |
| }); | |
| })(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <select class="my-select"> | |
| <option selected disabled value="">Placeholder (não é gerado como botão)</option> | |
| <option value="1">1</option> | |
| <option value="2">2</option> | |
| <option value="3">3</option> | |
| </select> |