Skip to content

Instantly share code, notes, and snippets.

View maxcelos's full-sized avatar
💭
Looking for awesomeness

Marcelo Silva maxcelos

💭
Looking for awesomeness
View GitHub Profile
server {
listen 80;
server_name CHANGEME.app;
root /var/www/vhosts/CHANGEME.app/public;
index index.html index.htm index.php;
charset utf-8;
location / {

Estados brasileiros

[
    "AC"=>"Acre",
    "AL"=>"Alagoas",
    "AM"=>"Amazonas",
    "AP"=>"Amapá",
    "BA"=>"Bahia",
    "CE"=>"Ceará",

"DF"=>"Distrito Federal",

How to customize ubuntu with Arc-Theme + Numix icons

  1. Install Unity Tweak Tool
sudo apt-get install unity-tweak-tool
  1. Add Arc repository
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/arc-theme.list"
@maxcelos
maxcelos / backup-sites
Last active December 18, 2018 16:06
Baixar todo o site em html
```
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains example.com --no-parent http://example.com
```
@maxcelos
maxcelos / BrPhoneMask.js
Last active July 5, 2017 19:28
Mascara de telefone ou celular Brasil
// Use a classe ".phoneNumber" no campo input do telefone
$('.phoneNumber').on('keyup', function (e) {
if(e.keyCode == 8){
let numberField = $(this);
let num = numberField.val();
if(num.length == 15){
let n = num.replace(/ /g, '');
n = n.split('');
@maxcelos
maxcelos / numberInput.js
Created June 27, 2017 12:58
Only numbers JQuery class mask
// To use it, jus add the "numberInput" class on your input field
$('.numberInput').on('keypress', function (e) {
// Accept only numbers
var charCode = (e.which) ? e.which : e.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
}).on('keyup', function () {
$(this).val($(this).val().replace(/\D/g, ''));
@maxcelos
maxcelos / money.js
Created June 27, 2017 13:00
Monetary JQuery mask
// To use it, jus add the "money" class on your input field
$('.money').on('keypress', function (e) {
// Accept only numbers
var charCode = (e.which) ? e.which : e.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
}).on('keyup', function (e) {
@maxcelos
maxcelos / slugify.js
Created September 27, 2017 16:45
Convert string to slug
function slugify (text) {
const a = 'àáãäâèéëêìíïîòóöõôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;';
const b = 'aaaaaeeeeiiiiooooouuuuncsyoarsnpwgnmuxzh------';
const p = new RegExp(a.split('').join('|'), 'g');
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c =>
b.charAt(a.indexOf(c))) // Replace special chars
.replace(/&/g, '-and-') // Replace & with 'and'
@maxcelos
maxcelos / underscoredSlug.js
Created September 27, 2017 16:55
Same as slugify.js but using underscore
// Same as slugify.js but using underscore
// Ex: "Anões de Jardim Botânico" will become "anoes_de_jardim_botanico"
function underscoredSlug (text) {
const a = 'àáãäâèéëêìíïîòóöõôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/-,:;';
const b = 'aaaaaeeeeiiiiooooouuuuncsyoarsnpwgnmuxzh______';
const p = new RegExp(a.split('').join('|'), 'g');
return text.toString().toLowerCase()
@maxcelos
maxcelos / serializeObject.js
Created October 27, 2017 11:53
Convert form data to json object
(function($){
$.fn.serializeObject = function(){
var self = this,
json = {},
push_counters = {},
patterns = {
"validate": /^[a-zA-Z][a-zA-Z0-9_]*(?:\[(?:\d*|[a-zA-Z0-9_]+)\])*$/,
"key": /[a-zA-Z0-9_]+|(?=\[\])/g,
"push": /^$/,