Skip to content

Instantly share code, notes, and snippets.

View abnersajr's full-sized avatar

Abner Soares Alves Junior abnersajr

View GitHub Profile
@abnersajr
abnersajr / correio-erros.json
Created April 30, 2013 16:00
JSON com todos os erros do webservice de calcular frete dos correios brasileiros.
{
"correios":{
"erros":[
{
"codigo":"0",
"descricao":"Processamento com sucesso"
},
{
"codigo":"-1",
"descricao":"Código de serviço inválido"
@abnersajr
abnersajr / placeholder-style
Created September 2, 2013 13:21
Style to native html5 placeholders
/*HTML5 Placeholders style*/
::-webkit-input-placeholder {
color: red;
}
:-moz-placeholder { /* Firefox 18- */
color: red;
}
<!DOCTYPE html>
<!--
Copyright 2010 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@abnersajr
abnersajr / Preferences.sublime-settings
Last active June 7, 2016 16:00
Sublime Text 3 user settings
{
"always_show_minimap_viewport": false,
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 3,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
"fade_fold_buttons": false,
"find_selected_text": true,
@abnersajr
abnersajr / paginationDots.js
Created February 7, 2014 10:54
Pagination three dots used by Sitionet
function paginationDots(){
//Verifica a paginação
if($('.page-wrap').length){
if($('.page-last').length){
var url_split = $('.page-last a').attr('href').split('/').reverse();
totalPagesLast = url_split[0];
}
if($('.page-first').length){
var url_split = $('.page-first a').attr('href').split('/').reverse();
totalPagesFirst = url_split[0];
@abnersajr
abnersajr / regexes.js
Created February 14, 2014 11:18
regexes
/*
* Regexes
*
*/
//Email
var emailRegExp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
//Full Name
var fullNameRegExp = /^(?:[\u00c0-\u01ffa-zA-Z'-]){2,}(?
@abnersajr
abnersajr / imageProportionalCalc
Created February 18, 2014 11:43
Cálculo de Imagens Proporcionais
/**
* Cálculo para imagens proporcionais foto Retrato
*/
$width = <valor>; // Largura da Foto que está sendo feito upload, obtido pelo getimagesize
$height = <valor>; // Altura da Foto que está sendo feito upload, obtido pelo getimagesize
$newWidth = <valor>; // Nova Largura Definida para a foto de acordo com o documento
$newHeight = ($newWidth/$width) * $height;
@abnersajr
abnersajr / sitionet.validate
Last active August 29, 2015 14:01
Validade Object with functions used to validate values on Sitionet Agency
var Validate = {
email: function( valor ) {
regex = new RegExp( /^([a-z0-9_\.\+-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ );
return regex.test( valor );
},
string: function ( valor ) {
return (typeof valor === "string");
},
float: function( valor ) {
valor = replaceAll( ',', '.', valor );
@abnersajr
abnersajr / calcYtoCenter.js
Created June 9, 2014 15:28
Calc image size needed to be centered with paralax
function calcYtoCenter(imageHeight,containerHeight){
return imageHeight - ( (imageHeight - containerHeight) / 2);
}
@abnersajr
abnersajr / center.css
Created July 4, 2014 15:10
magic to center
.outer{
float: left;
width: 150px;
background:red;
height: 220px;
position: relative;
margin: 15px;
overflow: hidden;
text-align: center;
line-height: 220px;