Skip to content

Instantly share code, notes, and snippets.

View brunopulis's full-sized avatar
:octocat:
Vá devagar, mas vá

Bruno Pulis brunopulis

:octocat:
Vá devagar, mas vá
View GitHub Profile
// Validate email
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
// Validate format files
/(png|jpg|jpeg)$
@brunopulis
brunopulis / validPhone.js
Created July 31, 2019 02:47 — forked from kaweski/validPhone.js
Valida telefones do Brasil com DDD, o 9º dígito e obrigatoriamente contendo 9 dígitos, mais espaços e caracteres de separação.
let regex = /^\([1-9]{2}\) 9 [7-9][0-9]{3}\-[0-9]{4}$/;
if( regex.test(c.value) ) {
return null;
} else {
return { phoneError: true };
}
function my_remove_wp_seo_meta_box() {
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal');
}
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100);
@brunopulis
brunopulis / remove-emoji.php
Created February 3, 2019 02:46
Remove Emoji Wordpress
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@brunopulis
brunopulis / remove-jquery-migrate.php
Created February 3, 2019 02:40
Remove jquery migrate from wordpress
// Dequeue jQuery Migrate script in WordPress.
function remove_jquery_migrate(&$scripts) {
if(!is_admin()) {
$scripts->remove( 'jquery');
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4' );
}
}
add_filter('wp_default_scripts', 'remove_jquery_migrate');
@brunopulis
brunopulis / .htaccess file - HTML5 Boilerplate
Last active September 24, 2019 17:09 — forked from erickarbe/.htaccess file - HTML5 Boilerplate
HTML5 Boilerplate .htaccess file - easy access
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
# httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
<section class="related-post">
<?php
$categories = get_the_category( $post->ID );
if ( $categories ) {
$category_ids = array();
foreach($categories as $individual_category)
$category_ids[] = $individual_category->term_id;
$args = array (
@brunopulis
brunopulis / modal.js
Created February 26, 2018 21:37
Module Modal
// Spaguette
let jsSearch = $('.menu-item:nth-child(1)').find('.menu-link').addClass('js-search');
let openMenu = $('.menu-item:nth-child(4)').find('.menu-link').addClass('js-link');
let openSearch = $('.banner-index__link');
let btnClose = $('.lightbox-close');
jsSearch.on('click', function() {
$('.lightbox--search').addClass('lightbox--open');
$('.lightbox--search').attr('aria-hidden', 'false');
@brunopulis
brunopulis / json
Created October 7, 2017 21:17
settings-vscode
{
"window.zoomLevel": 1,
"files.associations": {
"*.json": "json"
},
"workbench.welcome.enabled": false,
"typescript.check.tscVersion": false,
"workbench.iconTheme": "vs-seti",
"editor.renderWhitespace": "all",
"files.trimTrailingWhitespace": true,
@brunopulis
brunopulis / fetchAPI
Last active September 24, 2019 17:10
const URL = "http://swapi.co/api/people/1" // Retorna Luke Skywalker
fetch(URL)
.then(function(res){
res.json().then(function(data){
console.log(data);
});
})
.catch(function(err){
console.error('Não foi possível achar a informação', err);
});