Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Chegou o novo Moto X&#8308; com câmera inteligente, um novo conceito de smartphone com sistema de câmera traseira dupla, com recursos exclusivos, como foco seletivo, reconhecimento de objetos e efeitos de realidade aumentada.">
<meta name="author" content="Hugo Charles">
@felipemorais
felipemorais / route.js
Last active August 29, 2015 14:06
Angularjs - rota dinamica
function capitalize(value) {
return value && value.charAt(0).toUpperCase() + value.substring(1);
}
$stateProvider.state('docs', {
url: '/:module/:file',
templateUrl: function ($stateParams){
return '../../../views/' + $stateParams.module + '/' + $stateParams.file + '.html';
},
controllerProvider: function($stateParams, $controller) {
@felipemorais
felipemorais / dabblet.css
Created August 28, 2013 18:10 — forked from filaruina/dabblet.css
Untitled
*{margin:0;padding:0;box-sizing:border-box;}
body{padding:5px;}
li{list-style: none;}
.top_bar {
width: 700px;
height: 30px;
border: 1px solid #f00;
}
@felipemorais
felipemorais / gist:5878637
Created June 27, 2013 17:44
Javascript get string size. i.e. Cookie size
function getByteSize(s) {
return encodeURIComponent('<q></q>' + s).length;
}
getByteSize(document.cookie);
@felipemorais
felipemorais / gist:5328258
Last active December 15, 2015 21:49
Responsive Image solutions
#srcset - http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/
<img alt="The Breakfast Combo"
src="banner.jpeg"
srcset="banner-HD.jpeg 2x, banner-phone.jpeg 100w, banner-phone-HD.jpeg 100w 2x">
#picture tag - http://picture.responsiveimages.org/
<picture id="pictureElement">
<source media="(min-width: 45em)" srcset="large-1.jpg 1x, large-2.jpg 2x">
<source media="(min-width: 18em)" srcset="med-1.jpg 1x, med-2.jpg 2x">
<!-- assume media all -->
@felipemorais
felipemorais / gist:4989763
Created February 19, 2013 20:48
Format Currency - BRL
function formatCurrency( value ) {
var exit = [];
var i;
value = parseFloat( value );
value = value.toString().split("").reverse();
for( i = 0; i < value.length; i++ ) {
if( i == 2 ) {
exit.push( "," );