Skip to content

Instantly share code, notes, and snippets.

View knoonrx's full-sized avatar
🎯
Focusing

Rodrigo Brandão knoonrx

🎯
Focusing
View GitHub Profile
@knoonrx
knoonrx / autoloader.php
Last active April 13, 2017 12:34
Autoloader for wordpress theme
<?php
/**
* WordPress Theme Autoload
* Place on Root Theme
* Create a folder as classes
* This peace of code adds a autoloader into any wordpress theme you have
* to use this only follow the simple steps bellow
* create all your class files inside the folder named class
* and then just include this autoloader.php file in your theme functions.php
* require_once TEMPLATEPATH . '/autoloader.php';
@knoonrx
knoonrx / header.html
Last active January 7, 2016 02:01
Bootstrap 3 double line
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="collapse navbar-collapse col-lg-6 col-md-6">
<ul class="nav navbar-nav nav-logo navbar-left">
<li><a href="#"><img src="<?= bloginfo( 'template_url' ) ?>/images/favicon.png"></a></li>
</ul>
</div>
<div class="collapse navbar-collapse navbar-right col-lg-6 col-md-6">
@knoonrx
knoonrx / nove_digitos.js
Created January 7, 2016 13:00
Regex para formatar números de telefone 10 ou 11 caracteres (9 dígitos)
var numero = 2199999999;
var formatNumber;
formatNumber = numero.length === 11 ? numero.match(/(\d{2})(\d{5})(\d{4})/) : numero.match(/(\d{2})(\d{4})(\d{4})/);
var finalNumber = '('+ formatNumber[1]+') '+formatNumber[2]+' - '+formatNumber[3];
@knoonrx
knoonrx / Extenso.php
Last active December 28, 2022 09:33
Converte números e exibe por extenso em php Fonte: http://www.dirceuresende.com/blog/escrevendo-numero-por-extenso-no-php/
<?php
/**
* Created by PhpStorm.
* User: Rodrigo Brandão
* Date: 21/03/2016
* Time: 11:07
*/
class Extenso
{
public static function removerFormatacaoNumero( $strNumero )
@knoonrx
knoonrx / index.php
Created April 3, 2016 16:10
Simple Materialize css template menu for wordpress
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php bloginfo('name') ?></title>
<link type="text/css" rel="stylesheet" href="<?= get_template_directory_uri(); ?>/css/materialize.min.css" media="screen,projection">
<link type="text/css" rel="stylesheet" href="<?= get_template_directory_uri(); ?>/style.css">
<style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>teste</title>
<style>
ul {
list-style: none;
-moz-column-count: 4;
-moz-column-gap: 20px;
<?php
$date_expire = '2016-04-16';
$date = new DateTime($date_expire);
$now = new DateTime();
//echo $date->diff($now)->format("%d days, %h hours and %i minuts");
//$time = $date->diff($now)->format("%d");
//echo $time;
@knoonrx
knoonrx / checkddd.js
Last active May 11, 2016 19:49
Verifica se o ddd passado por parâmetro é válido (existe) ou não.
function pegaDDD(ddd) {
return parseInt(ddd.substr(1, 2));
}
function inArray(ddd) {
var dddArray = [11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 27, 28, 31, 32, 33, 34, 35, 37, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 53, 54, 55, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 77, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99];
return dddArray.indexOf(ddd) != -1;
}
@knoonrx
knoonrx / menu-justify.html
Created May 15, 2016 13:03
Materialize.css framework menu justify
<html>
<style>
/*menu justify*/
.menu-justified {
width: 100%;
}
.menu-justified>li {
float: none;
}
.menu-justified>li>a {
@knoonrx
knoonrx / storyline.html
Last active July 14, 2016 13:54
Responsive HTML + CSS + Bootstrap storyline
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<style>
.col-sm-2 {
padding: 0 !important;