Skip to content

Instantly share code, notes, and snippets.

@airton
airton / functions-wordpress.php
Last active February 26, 2016 15:08
Functions Wordpress
<?php
/* ==========================================================================
CUSTOMIZANDO MENU PRINCIPAL
========================================================================== */
class custom_menu extends Walker_Nav_Menu{
function start_lvl(&$output, $depth) {
$indent = str_repeat("", $depth);
@airton
airton / vanilla-js-vs-jquery.md
Last active February 24, 2016 20:23 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@airton
airton / favicon-interceptor.js
Created February 19, 2016 14:05 — forked from kentbrew/favicon-interceptor.js
How to short-circuit those annoying favicon requests in node.js
// early experiments with node had mysterious double requests
// turned out these were for the stoopid favicon
// here's how to short-circuit those requests
// and stop seeing 404 errors in your client console
var http = require('http');
http.createServer(function (q, r) {
// control for favicon
@airton
airton / javascript-vanilla-slideshow.css
Last active February 26, 2016 15:10
javascript-vanilla-slideshow
body {
font: normal 1.25em/1.5 Arial, sans-serif;
}
:focus {
outline: 1px dotted #EF9600;
outline-offset: 1px;
}
.slideshow {
position: relative;
// select element to unwrap
var el = document.querySelector('div');
// get the element's parent node
var parent = el.parentNode;
// move all children out of the element
while (el.firstChild) parent.insertBefore(el.firstChild, el);
// remove the empty element

Fazer o download do WordPress PT-BR

wp core download --locale=pt_BR

Criar o arquivo wp-config.php

  • wp core config --dbname=NOMEDATABASE --dbuser=root --dbpass= --dbhost=IPSERVER --dbprefix=PREFIX --locale=pt_BR --extra-php <<PHP
  • define( 'WP_DEBUG', false );
  • define( 'WP_DEBUG_LOG', false );
  • PHP

Instalar

Edit .bashrc
export PS1='\u@\h\[\033[01;34m\] \w\[\033[0;32m\]$(__git_ps1 " (%s)")\[\033[01;34m\]$\[\033[00m\] '
@airton
airton / scroll.js
Created February 2, 2017 16:30
es6 scroll module
/**
* Scroll Handling & Smooth Scroll
*/
let scroll = {
/**
* Fires a function on scroll with request animation frame
* @param {Function} fn Function to fire on scroll event
*/
on: (fn) => {
window.addEventListener('scroll', () => window.requestAnimationFrame(fn))
@airton
airton / git-rebase.markdown
Created May 18, 2017 14:48 — forked from tmcgilchrist/git-rebase.markdown
Git rebase workflow

Checkout a new working branch

 git checkout -b <branchname>

Make Changes

 git add
 git commit -m "description of changes"

Sync with remote