Skip to content

Instantly share code, notes, and snippets.

View pedrorvidal's full-sized avatar

Pedro Vidal pedrorvidal

  • Porto Alegre, Brazil.
  • 02:14 (UTC -03:00)
View GitHub Profile
// import { src, dest, watch, series, parallel } from 'gulp';
const { src, dest, watch, series, parallel } = pkg;
import pkg from 'gulp';
import yargs from 'yargs';
import sass from 'gulp-sass';
import cleanCss from 'gulp-clean-css';
import gulpif from 'gulp-if';
import postcss from 'gulp-postcss';
import sourcemaps from 'gulp-sourcemaps';
function add_theme_caps() {
// gets the author role
$role = get_role( 'testarole' );
// create if neccesary
if (!$role) $role = add_role('testarole', 'Testa Role');
// add theme specific roles
$role->add_cap('delete_posts');
$role->add_cap('delete_published_posts');
$role->add_cap('edit_posts');
add_filter( 'wp_head', function(){
if (is_page(XX) && !is_user_logged_in()) {
add_filter('the_content', function(){
return __('Sorry! Onlu logged-in user are allowed to see the content');
}, 99);
}
});
@pedrorvidal
pedrorvidal / brazil-cities-states-en.json
Created September 6, 2019 13:37 — forked from djalmaaraujo/brazil-cities-states-en.json
Cidades e estados brasileiros JSON & Javascript Object exported / Brazilian States and Cities in JSON or JS/Javascript
{
"states": [
{
"uf": "AC",
"name": "Acre",
"cities": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@pedrorvidal
pedrorvidal / tmux-cheatsheet.markdown
Created August 14, 2019 16:42 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@pedrorvidal
pedrorvidal / .tmux.conf
Created August 14, 2019 16:23 — forked from subfuzion/.tmux.conf
My .tmux.conf for tmux 2.1 (with fixes for mouse breakage)
# Inspirations:
# http://mutelight.org/practical-tmux
# http://zanshin.net/2013/09/05/my-tmux-configuration/
# http://files.floriancrouzat.net/dotfiles/.tmux.conf
# http://stackoverflow.com/questions/9628435/tmux-status-bar-configuration
# https://github.com/Lokaltog/powerline
# https://github.com/remiprev/teamocil
# http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux
# http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
#
@pedrorvidal
pedrorvidal / functions.php
Created July 28, 2019 19:08
Estados e cidades brasileiras populados em uma taxonomia do wordpress.
<?php
// É aconselhável criar um backup do banco antes
// crie a taxonomia cidade na functions do tema
add_action('init', 'register_locations');
function register_locations() {
register_taxonomy( 'cidade',array (
0 => 'locais',
),
array( 'hierarchical' => true,
@pedrorvidal
pedrorvidal / cloudSettings
Last active January 12, 2022 14:26
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-01-12T14:26:48.418Z","extensionVersion":"v3.4.3"}
@pedrorvidal
pedrorvidal / spotify_keybindings
Created July 4, 2017 19:16 — forked from jbonney/spotify_keybindings
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@pedrorvidal
pedrorvidal / custom-loop.php
Created May 16, 2017 14:25
WP Sort by multiple meta's
<?php
$WP_categorias_filtro = array(
'post_type' => array('proposta', 'problema'),
'posts_per_page' => 6,
'meta_query' => array(
'relation' => 'OR',
'contagem' => array(
'key' => 'contagem_views',
'type' => 'NUMERIC',
'compare' => 'EXISTS'