Skip to content

Instantly share code, notes, and snippets.

View antonioanerao's full-sized avatar

Antonio Anerão antonioanerao

View GitHub Profile
@antonioanerao
antonioanerao / autoload.php
Created July 1, 2017 22:25
simple autoload
<?php
spl_autoload_register(function($nameClass)
{
$dirName = "classes";
$filename = $dirName . DIRECTORY_SEPARATOR . $nameClass . ".class.php";
if(file_exists($filename))
{
require_once($filename);
<?php
require_once("autoload.php");
$crud = new Crud();
?>
<!DOCTY E html>
<html>
<head>
<title></title>
</head>
@antonioanerao
antonioanerao / php
Created August 24, 2017 01:51
add inputs
<?php
require_once("autoload.php");
$crud = new Crud();
?>
<!DOCTY E html>
<html>
<head>
<title></title>
</head>
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => '5',
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
);
query_posts($args);
?>
<?php
@antonioanerao
antonioanerao / api-saraiva.php
Created August 2, 2018 13:45
api-saraiva-result
<?php
$url="http://pac.livrariasaraiva.com.br/SaraivaIntegracao/views/saraivaintegracao.aspx?Tipo=ConsultaParcelamentoVitrineSite&Token=1&IdOrigem=1&TipoRetorno=JSON&Id=10171629";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
@antonioanerao
antonioanerao / functions.php
Last active September 5, 2019 17:20
Gera resumo de um post
<?php
function content($limit)
{
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit)
{
array_pop($content);
$content = implode(" ",$content).'...';
}
else
@antonioanerao
antonioanerao / categories.php
Created September 10, 2019 12:08
Listar categorias wordpress
<?php wp_list_categories(array('show_count' => 1, 'title_li' => __( 'Categories' ) )); ?>
@antonioanerao
antonioanerao / categorias.php
Created September 10, 2019 13:42
Listar categorias
<?php
$args=array(
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($args);
foreach($categories as $category)
echo '<li><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "Ver postagens em %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
echo '</li>';
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
@antonioanerao
antonioanerao / .conkyrc
Last active March 2, 2023 15:11
Config do meu conky
conky.config = {
update_interval = 1,
cpu_avg_samples = 2,
net_avg_samples = 2,
out_to_console = false,
override_utf8_locale = true,
double_buffer = true,
no_buffers = true,
text_buffer_size = 32768,
imlib_cache_size = 0,