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 / js_onclick_open_new_tab.html
Created January 21, 2019 14:01
JS - Onclick open new Tab
<!-- Source: https://stackoverflow.com/q/4907843/2854878 -->
<li class="dropdown custom" id="header-dd-notification">
<a href="javascript:void(0);" onclick="window.open('https://amazonaws.com/static/manual-usuario/MANUAL.pdf', '_blank')"
title="Manual do Usuário"
class="dropdown-toggle" target="_blank" data-toggle="dropdown">
<span class="meta">
<span class="icon"><i class="ico-book"></i></span>&nbsp;Manual do Usuário
</span>
</a>
</li>
@clebersonfalk
clebersonfalk / zf1_show_session_data.php
Created December 7, 2018 19:00
ZF1 - Show Session data (getIterator)
<?php
$session = new Zend_Session_Namespace("importar");
$data = $session->getIterator();
Zend_Debug::dump($data);die;
@clebersonfalk
clebersonfalk / Sort_array_multi_by_column_value.php
Created November 6, 2018 16:25
Sort multidimensional array by column value
<?php
array_multisort(array_column($prioridades, 'total'), SORT_DESC, $prioridades);
// Before
array(5) {
[0] => array(3) {
["tipo"] => string(15) "Prioridade Alta"
["prioridade"] => string(1) "1"
["total"] => string(1) "1"
@clebersonfalk
clebersonfalk / JS_create_date_hour.js
Created October 31, 2018 18:48
Javascript - Create Date and Hour
$('#termos').on('click', function (event) {
var date = new Date(),
y = date.getFullYear(),
m = ("0" + (date.getMonth() + 1)).slice(-2),
d = ("0" + date.getDate()).slice(-2),
h = ("0" + date.getHours()).slice(-2),
i = ("0" + date.getMinutes()).slice(-2),
s = ("0" + date.getSeconds()).slice(-2),
dt = y + '-' + m + '-' + d,
hr = h + ':' + i + ':' + s;
@clebersonfalk
clebersonfalk / ZF1_Cache.php
Last active October 31, 2018 13:18
ZF1 - Configure and using Cache
<?php
// See more: https://stackoverflow.com/a/6263810/2854878
// Configure Cache in Bootstrap.php
public function _initCache () {
$cache = Zend_Cache::factory(
'Core',
'File',
array(
@clebersonfalk
clebersonfalk / Laravel_load_js_view.php
Last active October 31, 2018 01:21
Laravel - Carregar arquivos JS a partir da View das actions
/**
* No seu layout principal, inclua a linha @yield('pagescript')
*
* No arquivo blade da View que precisa do javascript, inclua uma @section que carregue
* o javascript necessário para essa visualização.
* As exibições que não tiverem uma seção 'pagescript' não exibirão erros.
*/
// No layout principal
@yield('pagescript')
@clebersonfalk
clebersonfalk / ZF1_Create_View_Helper.php
Created October 30, 2018 20:37
ZF1 - Create a View Helper
<?php
class Cms_View_Helper_Myhelper extends Zend_View_Helper_Abstract
{
public function myhelper()
{
// Busca a política de privacidade e contratos
$model = new Admin_Model_Produtos();
$select = $model->select()
->from('produtos')
@clebersonfalk
clebersonfalk / ZF1_Create_Controller_Plugin.php
Last active October 30, 2018 20:18
ZF1 - Create a Controller Plugin
<?php
// https://stackoverflow.com/a/1537911
class Cms_Controller_Plugin_Myplugin extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMvcInstance();
$view = $layout->getView();
@clebersonfalk
clebersonfalk / iptv
Created October 28, 2018 01:30
IP TV
http://listaiptvbrasilhd.com.br/lista.m3u
@clebersonfalk
clebersonfalk / smarty_debug_variable.php
Created October 19, 2018 18:51
Smarty Debug Variable
// Method 1:
{$var|@var_dump}
// Method 2:
{php}
$var =
$this->get_template_vars('var');
var_dump($var);
{/php}