Skip to content

Instantly share code, notes, and snippets.

View clebersonfalk's full-sized avatar

Cleberson Falk clebersonfalk

  • Java Software Engineer at ASAAS
  • Londrina - PR
View GitHub Profile
@clebersonfalk
clebersonfalk / gist:4a30014fd3b0d09fea8e0159743b4f72
Last active September 12, 2017 18:47
Zend_Form create element in controller
$descricao_cliente_element = new Zend_Form_Element_Textarea('descricao_cliente');
$descricao_cliente_element->setAttribs(['ROWS' => '10', 'class' => 'form-control']);
$descricao_cliente_element->removeDecorator('label');
$form_pastas->addElement($descricao_cliente_element);
->columns(array(
'descricao' => new Zend_Db_Expr(sprintf("(CASE
WHEN %d IN(13,21,23,25)
THEN `pt`.`descricao_cliente`
ELSE `pt`.`descricao`
END)", $id_role))
))
@clebersonfalk
clebersonfalk / gist:b86de9d772da52a4b2fb1887aa356ffa
Last active October 2, 2017 18:40
Zend Framework 1 - Create select with Zend_Db::factory()
<?php
// $db = Zend_Db::factory()
$select = $db->select()
->from('log', [])
->columns([
'id',
'message',
'url',
'date',
@clebersonfalk
clebersonfalk / Zend_Db_Factory.php
Last active October 2, 2017 18:39
Zend_Db Factory
<?php
$params = array(
'host' => $data->host,
'username' => $data->login,
'password' => $data->password,
'dbname' => $data->database,
'driver_options' => [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]
);
@clebersonfalk
clebersonfalk / disable_layout.php
Created October 3, 2017 14:09
Zend Framework 1 - Disable Layout and View Render Raw
<php
// Disable layout and view Renderer
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
@clebersonfalk
clebersonfalk / products_created_last_12_month.sql
Last active October 9, 2017 13:20
Get the quantity of products created in the last 12 months
SELECT
count(*) as qtd_products,
DATE_FORMAT(created, '%m/%Y') as month
FROM
products
WHERE
created > DATE_SUB(DATE_FORMAT(NOW(), '%Y/%m/01'), INTERVAL 12 MONTH)
GROUP BY MONTH(created)
ORDER BY created DESC;
@clebersonfalk
clebersonfalk / Example_selectize.html
Created November 9, 2017 13:48
Example of Selectize with ajax and default value (edit)
<form action="" method="get" id="form-pag-quit-gar" name="form-pag">
<div class="row row-fields">
<div class="col-md-4">
<label class="control-label" for="pagador">Pagador</label>
<select class="form-control" name="pagador" id="pagador" data-actual-label="<?php echo $this->pagador_user->nome; ?>" data-actual-value="<?php echo $this->pagador; ?>">
<option value="0">Selecione</option>
</select>
</div>
<div class="col-md-4">
<label class="control-label" for="favorecido">Favorecido</label>
@clebersonfalk
clebersonfalk / tooltip_dynamic_elements.js
Created November 22, 2017 17:21
Bootstrap Tooltip to dynamically created elements
$('body').tooltip({
selector: '[data-toggle=tooltip]'
});
@clebersonfalk
clebersonfalk / zf1_set_custom_layout_template.php
Last active January 22, 2018 13:28
Set a custom Layout and Template in Zend Framework 1
// Set a custom Layout
$this->_helper->layout->setLayout('default');
// Set a custom Template
$this->_helper->viewRenderer->setRender('list2');
@clebersonfalk
clebersonfalk / .gitignore
Created February 20, 2018 18:50
Example of .gitignore files, but not ignore directory.
.idea/
cache/*
# Ignorar os arquivos do diretório
application/tmp/templates_c/*
# Porém, manter o diretório versionado
!application/tmp/templates_c/.gitkeep