Skip to content

Instantly share code, notes, and snippets.

View davidcostadev's full-sized avatar
😎

David Costa davidcostadev

😎
View GitHub Profile
@davidcostadev
davidcostadev / happy.php
Created March 26, 2017 22:38
Happy Birth Code Gilvan Costa
<?php
class People {
public $name;
public $birth;
}
$dad = new People();
$dad->name = 'Gilvan Costa';
$dad->birth = new Datetime('26-03-1971', new DateTimeZone('America/Recife'));
@davidcostadev
davidcostadev / toAmigavel.php
Created December 9, 2016 00:54
Converter string para urls amigaveis
<?php
/**
* Convertendo textos para urlamigavel
* @param type $texto
* @return String
*/
function toamigavel($texto) {
$texto = mb_strtolower($texto, 'UTF-8');
@davidcostadev
davidcostadev / AppView.php
Last active May 24, 2018 22:06
Compress output html afterRender view cakephp 3
<?php
namespace App\View;
use Cake\View\View;
use Cake\Event\Event;
class AppView extends View
{
@davidcostadev
davidcostadev / fixe-sidebar.js
Created August 21, 2016 18:47
Fixed sidebar on scrooll with little jquery
function FixedSidebar(sidebarName) {
var self = this;
this.elSidebar = document.getElementById(sidebarName);
this.elContent = this.elSidebar.parentNode;
this.elBody = document.getElementsByTagName('body')[0];
this.lastBodyHeight = this.elBody.clientHeight;
this.lastSidebarHeight = this.elSidebar.clientHeight;
this.lastContentHeight = this.elContent.clientHeight;