Skip to content

Instantly share code, notes, and snippets.

View davidcostadev's full-sized avatar
😎

David Costa davidcostadev

😎
View GitHub Profile
@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;
@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 / 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 / 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 / keybindings.json
Last active April 28, 2018 14:29
vscode-davidcostadev.md
//ubuntu
[
{
"key": "ctrl+[slash]",
"command": "editor.action.commentLine"
},
{
"command": "editor.action.blockComment",
"key": "ctrl+shift+[slash]",
"when": "editorTextFocus && !editorReadonly"
@davidcostadev
davidcostadev / keys.json
Created May 1, 2017 15:32
Sublime Text 3
[
{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+shift+v"], "command": "paste" }
]
version: '2'
services:
mysqlserver:
image: mysql
ports:
- "3306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 123
@davidcostadev
davidcostadev / install.sh
Last active June 22, 2017 00:16 — forked from imposibrus/install.sh
Install MongoDB PHP driver on Ubuntu 14.04
sudo apt-get install -y php-pear php5-dev
sudo pecl install mongo
sudo sh -c "echo 'extension=mongo.so' > /etc/php/7.0/mods-available/mongo.ini"
sudo ln -s /etc/php/7.0/mods-available/mongo.ini /etc/php/7.0/apache2/conf.d/mongo.ini
sudo service apache2 restart
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia \
--volume /Volumes/MyVolume \
--applicationpath /Applications/Install\ macOS\ Sierra.app
@davidcostadev
davidcostadev / promises.js
Created July 1, 2017 19:14
Estruturando promises
function calcular() {
return new Promise((resolve, reject) => {
console.log('inicio...')
resolve()
})
}
function um() {