Skip to content

Instantly share code, notes, and snippets.

View luizventurote's full-sized avatar

Luiz Venturote luizventurote

View GitHub Profile
@luizventurote
luizventurote / required-featured-image.php
Last active August 29, 2015 13:57
Alerta de uso obrigatório de imagem destacada antes da publicação de qualquer artigo.
@luizventurote
luizventurote / age-function.sql
Last active August 29, 2015 13:57
SQL function that returns the age.
DROP FUNCTION IF EXISTS fn_idade;
DELIMITER $$
CREATE FUNCTION fn_idade(data_nascimento DATE)
RETURNS INT
LANGUAGE SQL
BEGIN
RETURN (Year(Curdate()) - Year(data_nascimento)) -(Right(Curdate(),5) < (Right(data_nascimento,5)));
END;
@luizventurote
luizventurote / ahp-algorithm.c
Created March 31, 2014 21:02
Analytic hierarchy process algorithm.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TAM 100
#define QUA 100
struct Alternativas
{
float nota[TAM];
float classificacao[TAM][TAM];
@luizventurote
luizventurote / wordpress-snippets.php
Last active August 29, 2015 13:58
Wordpress Snippets.
<!-- Get Head -->
<?php wp_head(); ?>
<!-- The title -->
<?php wp_title(''); ?>
<!-- Get Template Directory URI -->
<?php echo get_template_directory_uri(); ?>
@luizventurote
luizventurote / wordpress-post-snippets.php
Last active August 29, 2015 13:58
Snippets for Wordpress posts.
<?php
/**
* get_the_date - Retrieves the date the current $post was written
*/
get_the_date( $date );
/**
* get_comments_number - Retrieves the value of the total number of comments for a post.
*/
<?php
// Nav Menu Dropdown Class
include_once( CHILD_DIR . '/lib/classes/nav-menu-dropdown.php' );
/**
* Mobile Menu
*
*/
function be_mobile_menu() {
@luizventurote
luizventurote / Aluno.java
Created April 10, 2014 12:24
Exercício de diagrama de classes - Aula de UML para código.
package escola;
import java.util.ArrayList;
public class Aluno extends Pessoa {
private int numeroMatricula;
private int anoInicioCurso;
private Bolsa bolsa;
private ArrayList<Disciplina> disciplinas;
@luizventurote
luizventurote / sanitize-string.php
Created April 13, 2014 02:59
Sanitize String - PHP.
<?php
/**
* Sanitize String
*
* @param string $str string to be cleaned
* @return string new string without special characters
*/
function sanitizeString($str) {
$str = preg_replace('/[áàãâä]/ui', 'a', $str);
@luizventurote
luizventurote / get-date-array.php
Created April 16, 2014 18:36
Get Date array by date.
<?php
/**
* Get Date array by date
*
* @param string $myDate Date in the format format dd/mm/yyyy
* @return array Date array
*/
function getDateArray($myDate) {
@luizventurote
luizventurote / auto-fields.php
Created April 28, 2014 18:10
Auto fields in PHP.
<?php
$fields = array();
$fields[] = array(
"title" => "Nome",
"id" => "nome",
"type" => "text"
);