Instantly share code, notes, and snippets.

View Estrutura de banco de dados
SELECT COUNT(1) AS qtd,
tipo
FROM (SELECT DISTINCT table_schema AS objeto,
'esquemas' AS tipo
FROM information_schema.tables
WHERE table_schema != 'pg_catalog'
AND table_schema != 'information_schema'
UNION ALL
SELECT table_schema || '.' || table_name AS objeto,
CASE WHEN table_type = 'BASE TABLE' THEN 'tabelas'
View collection_widget.twig
{% block collection_widget %}
{% spaceless %}
<div class="collection">
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': block('collection_item_widget') }) %}
{% endif %}
<div {{ block('widget_container_attributes') }}>
{{ form_errors(form) }}
<ul>
{% for rows in form %}
View presencas simplificado
SELECT cae.caenome as nome,
cae.caecpf as cpf,
prc.perid,
SUM(frq.frqqtdpresenca) as qtdpresenca
FROM projovemurbano.cadastroestudante cae
INNER JOIN projovemurbano.frequenciaestudante frq ON frq.caeid = cae.caeid
INNER JOIN projovemurbano.diariofrequencia dif ON dif.difid = frq.difid
INNER JOIN projovemurbano.diario dia ON dia.diaid = dif.diaid
INNER JOIN projovemurbano.periodocurso prc USING(perid)
-- WHERE cae.caeid = 44327
View presencas
SELECT nome,
cpf,
sum(qtd_periodo1) as qtd_periodo1,
sum(qtd_periodo2) as qtd_periodo2,
sum(qtd_periodo3) as qtd_periodo3,
sum(qtd_periodo4) as qtd_periodo4,
sum(qtd_periodo5) as qtd_periodo5,
sum(qtd_periodo6) as qtd_periodo6,
sum(qtd_periodo7) as qtd_periodo7
FROM (SELECT cae.caenome as nome,
View gist:6064074
function parsePostSegundaEtapa() {
// -- Validando $_POST e $_FILES
if (empty($_POST) ) {
$e = new Exception('Tipo de requisição inválida.');
throw $e;
}
$arquivos = array();
// -- Lista de documentos enviados pelo proponente
$documentos = array('contrato_social', 'rg_e_cpf', 'comp_endereco',
'comp_bancario', 'logo');
View acl_linha_a_linha.php
<?php
foreach ($rowset['rs'] as $item) {
$acoes = array('acoes' => '');
$acl = Zend_Registry::get('acl');
$resource = $acl->formatNameResource(array('module' => 'unidade', 'controller' => 'index'));
if ($acl->isAllowed(null, $resource, 'get')) {
$acoes['acoes'] .= $this->view->open('Unidade', $item->id_unidade_prisional, 'Abrir Unidade Prisional');
}
View gist:5529672
-- 1)
function enemy:shoot()
local Bullet = require "Bullet";
Bullet.owner = self;
-- the same as your previous code
end;
function enemy:canShootAgain()
self.activeBul = false;
end;