Skip to content

Instantly share code, notes, and snippets.

Working from home

Leo Dutra leodutra

Working from home
View GitHub Profile
leodutra / request-animation-frame-polyfill.js
Last active Dec 3, 2015 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
View request-animation-frame-polyfill.js
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "". For a pattern that attempts to
match all URLs, regardless of protocol, see:
# Single-line version:
View Liberal Regex Pattern for All URLs
The regex patterns in this gist are intended to match any URLs,
including "", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
# Single-line version of pattern:
leodutra / .fonts.conf
Last active Nov 8, 2016 — forked from odony/.fonts.conf
"Updated version of the fonts.conf file mentioned in in order to get rid of most of the fontconfig warnings (mostly the "Having multiple values in <test> isn't supported and may not work as expected")" - @odony
View .fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
Documented at
To check font mapping run the command at terminal
$ fc-match 'helvetica Neue'
# Prepare pacman
sudo mkdir -p /root/.gnupg
sudo pacman-key --init && sudo pacman-key --populate archlinux manjaro && sudo pacman-key --refresh-keys
# Remove packages
sudo pacman -R empathy accerciser gnome-chess gnome-sudoku gnome-tetravex polari five-or-more four-in-a-row steam-native ipython hitori gnome-klotski steam quadrapassel gnome-nibbles aisleriot lightsoff gnome-mahjongg gnome-mines iagno gnome-robots tali swell-foop
# Upgrade all
sudo pacman -Syyu
leodutra /
Created Sep 18, 2017 — forked from subfuzion/
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions


  • 400 BAD REQUEST: The request was invalid or cannot be otherwise served. An accompanying error message will explain further. For security reasons, requests without authentication are considered invalid and will yield this response.
  • 401 UNAUTHORIZED: The authentication credentials are missing, or if supplied are not valid or not sufficient to access the resource.
  • 403 FORBIDDEN: The request has been refused. See the accompanying message for the specific reason (most likely for exceeding rate limit).
  • 404 NOT FOUND: The URI requested is invalid or the resource requested does not exists.
  • 406 NOT ACCEPTABLE: The request specified an invalid format.
View 1-restify-server-cheatsheet.js
// Restify Server CheatSheet.
// More about the API:
// Install restify with npm install restify
// 1.1. Creating a Server.
var restify = require('restify');
leodutra / restify-joi-validation.js
Created Nov 17, 2017 — forked from nkt/restify-joi-validation.js
Restify middleware for validation using Joi package
View restify-joi-validation.js
const {BadRequestError} = require('restify/lib/errors');
const Joi = require('joi');
module.exports = function validationPlugin() {
const fields = ['params', 'query', 'body'];
return function validationMiddleware(req, res, next) {
if (!req.route || !req.route.validate) {
return next();
leodutra / nginx.conf
Created Nov 20, 2017 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
View nginx.conf
# CORS header support
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
# include cors_support;
# As of Nginx 1.7.5, add_header supports an "always" parameter which
leodutra /
Created Jan 25, 2018 — forked from kerryboyko/
VueJS Best Practices Guide

Deverus Vue.js Style Guide

Guide for developing Vue.js applications.

v. 0.0.1

Vue.js is an amazing framework, which can be as powerful as Angular or React, the two big heavy hitters in the world of front-end frameworks.

However, most of Vue's ease-of-use is due to the use of Observables - a pattern that triggers re-renders and other function calls with the reassignment of a variable.