Skip to content

Instantly share code, notes, and snippets.

View rodrigobertin's full-sized avatar

RNB Developer rodrigobertin

View GitHub Profile
@rodrigobertin
rodrigobertin / rezise.php
Created June 13, 2015 15:14
rezise image
//redimensionar
function rezise($SrcImage, $DestImage, $MaxWidth=980, $MaxHeight=0, $Quality=90) {
list($iWidth, $iHeight, $type)=getimagesize($SrcImage);
//echo $type;
//solo redimensional mayores a 1200
if ($iWidth>3000 || $iHeight>3000) {
//=== si no se pone el alto ====//
if (($MaxHeight == 0) && isset($MaxWidth)) {
@rodrigobertin
rodrigobertin / seleccionado.js
Created January 15, 2014 23:52
Option seleccionado con jquery
$("#provincia option[value="+ valor +"]").attr("selected",true);
@rodrigobertin
rodrigobertin / installCentos.sh
Last active March 9, 2017 15:44
Instalaciones CENTOS Vagrant
#Actualizar
yum update
#instalar apache
yum install -y httpd
#iniciar apache
sudo service httpd start
#nano
@rodrigobertin
rodrigobertin / phpmailer-wp.php
Last active September 18, 2017 13:23
PHP Mailer WP
<?php
/**
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*/
function send_smtp_email($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->isHTML(true);
$phpmailer->Host = "smtp.gmail.com";
@rodrigobertin
rodrigobertin / hide-editor.php
Created September 18, 2017 13:56
Hide editor in certain pages
<?php
/**
* Hide the main editor on specific pages
*/
define('EDITOR_HIDE_PAGE_TITLES', json_encode(array()));
define('EDITOR_HIDE_PAGE_TEMPLATES', json_encode(array('template-cars.php')));
/**
* Hide the main editor on defined pages
@rodrigobertin
rodrigobertin / fixHeader.js
Created October 4, 2017 02:13
Fix Header
$(window).scroll(function(){
if ($(window).scrollTop() >= 300) {
$('nav').addClass('fixed-header');
}
else {
$('nav').removeClass('fixed-header');
}
});
@rodrigobertin
rodrigobertin / mailChimp.php
Created October 4, 2017 17:37
Api para mailchimp basica
class MailChimp {
private $username;
private $pass;
private $status_code;
private $curl_response;
const apiKey = '261fdbc6602031972b5e5829367d5fa6-us16';
const url = 'https://us16.api.mailchimp.com/3.0/';
@rodrigobertin
rodrigobertin / js_css.php
Created October 5, 2017 04:40
Cargar JS y CSS Wordpress
<?php
// Load the theme stylesheets
function theme_styles() {
// Example of loading a jQuery slideshow plugin just on the homepage
wp_register_style(
'bootstrap-styles', // handle name
get_template_directory_uri() . '/css/styles.min.css', // the URL of the stylesheet
array(), // an array of dependent styles
@rodrigobertin
rodrigobertin / nav.js
Created October 5, 2017 05:04
Nav animado
$('nav a').on('click', function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
@rodrigobertin
rodrigobertin / .htaccess
Created October 5, 2017 11:04
htaccess seguro
AddDefaultCharset utf-8
## Seguridad extra para PHP
RewriteEngine On
# Usar siempre https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Options +FollowSymLinks