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 minhaescola.* | |
| class BootStrap { | |
| def init = { servletContext -> | |
| Escola escola = new Escola(nome: "Escola Profa Alexandrina Santos Pita", apelido: "esc-profa-alexandrina-santos-pita") | |
| escola.save(flush: true) | |
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
| package minhaescola | |
| import static org.springframework.http.HttpStatus.* | |
| import grails.transaction.Transactional | |
| @Transactional(readOnly = true) | |
| class EscolaController { | |
| static responseFormats = ['html', 'xml', 'json'] |
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
| var Escola = function(){ | |
| this.fillSelect = function(){ | |
| $.get('/escola/index.json', {}, function(data){ | |
| $.each(data, function(index, escola){ | |
| $("#escola-id").append('<option value="'+escola.id+'">'+escola.nome+'</option>'); | |
| }); | |
| }, "json"); | |
| }; | |
| }; |
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 | |
| use Fw\Nano as Nano; | |
| $app = new Nano; | |
| $app->db_config = [ | |
| 'host' => 'localhost', | |
| 'user' => 'nano_user', | |
| 'pass' => 'password', |
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
| class Blue(): | |
| def is_blue(): | |
| return "Blue" | |
| class Red(): | |
| def is_red(): | |
| return "Red" | |
| class Pallet("Blue", "Red"): | |
| def blue(self): |
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
| from flask import Flask,jsonify | |
| app = Flask(__name__) | |
| @app.route("/") | |
| def hello(): | |
| return "Hello World!" | |
| if __name__ == "__main__": | |
| app.run( | |
| host="0.0.0.0", |
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 scrapy | |
| class DogBreed(scrapy.Spider): | |
| name = 'dogbreed' | |
| start_urls = ['http://dogtime.com/dog-breeds'] | |
| def parse(self, response): | |
| for breed in response.css('div.article-crumbs > div.group-list-item'): | |
| yield { | |
| 'name' : breed.css('h2 > a.post-title::text').extract_first(), |
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 scrapy | |
| class DogBreed(scrapy.Spider): | |
| name = 'dogbreed' | |
| start_urls = ['http://dogtime.com/dog-breeds'] | |
| def parse(self, response): | |
| # pegar diretamente da pagina do artigo | |
| for href in response.css('div.article-crumbs > div.group-list-item > h2 > a::attr(href)').extract(): | |
| yield scrapy.Request( |
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
| {% if escolas %} | |
| <ul> | |
| {% for escola in escolas %} | |
| <li><a href="{{ escola.id }}">{{ escola.nome }}</a></li> | |
| {% endfor %} | |
| </ul> | |
| {% else %} | |
| <p>Nenhuma Escola encontrada.</p> | |
| {% endif %} |
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
| from django.http import HttpResponse | |
| from django.template import loader | |
| from .models import Escola, EscolaSegmento, Serie, Turma | |
| def index(request): | |
| escolas = Escola.objects.all() | |
| template = loader.get_template('escola/index.html') | |
| context = { | |
| 'escolas' : escolas, |
OlderNewer