Skip to content

Instantly share code, notes, and snippets.

@renancouto
renancouto / CorrigirEstados.js
Created September 25, 2012 21:46
Corrigir nomes dos estados brasileiros
var CorrigirEstados = function(estado) {
switch (estado.toLowerCase()) {
case 'amapa' :
estado = 'Amapá';
break;
case 'ceara' :
estado = 'Ceará';
break;
@renancouto
renancouto / ConverterEstados.js
Created September 25, 2012 21:51
Converter o nome do estado para UF ou UF para nome.
var ConverterEstados = function(val) {
var data;
switch (val.toUpperCase()) {
/* UFs */
case "AC" : data = "Acre"; break;
case "AL" : data = "Alagoas"; break;
case "AM" : data = "Amazonas"; break;
case "AP" : data = "Amapá"; break;
case "BA" : data = "Bahia"; break;
@renancouto
renancouto / color.lighten.js
Created January 30, 2013 17:58
Method to lighten / darken hex colors using Javascript.
var LightenColor = function(color, percent) {
var num = parseInt(color,16),
amt = Math.round(2.55 * percent),
R = (num >> 16) + amt,
B = (num >> 8 & 0x00FF) + amt,
G = (num & 0x0000FF) + amt;
return (0x1000000 + (R<255?R<1?0:R:255)*0x10000 + (B<255?B<1?0:B:255)*0x100 + (G<255?G<1?0:G:255)).toString(16).slice(1);
};
@renancouto
renancouto / index.html
Created February 21, 2013 16:56
A CodePen by renancouto. 50 Shades of Gray - Just a quick experiment with SCSS's while loop.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<h1>50 Shades of Gray</h1>
@renancouto
renancouto / select.meses.html
Created April 26, 2013 16:32
Select simples com nomes dos meses do ano
<select>
<option>Escolha o mês</option>
<option value="01">Janeiro</option>
<option value="02">Fevereiro</option>
<option value="03">Março</option>
<option value="04">Abril</option>
<option value="05">Maio</option>
<option value="06">Junho</option>
<option value="07">Julho</option>
<option value="08">Agosto</option>
@renancouto
renancouto / Preferences.sublime-settings
Last active December 19, 2015 22:39
Sublime Text User Settings
{
"bold_folder_labels": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".sass-cache"
],
@renancouto
renancouto / INSTALL.ME
Last active December 25, 2015 15:19
INSTALL.ME - Cross-platform sugar! A collection of installation instructions to show how (bad) different systems are.
https://github.com/voodootikigod/node-serialport
@renancouto
renancouto / social.js
Created November 4, 2013 19:44
Loading social scripts (Facebook, Twitter and Google Plus) AMD style.
/*jslint browser:true, nomen:true*/
/*global define*/
define(function () {
'use strict';
var script = document.getElementsByTagName('script')[0];
function socialTag(src, id) {
var created = document.createElement('script');
@renancouto
renancouto / jsonfiles2object.js
Created August 15, 2014 19:11
Read all json files on the current dir and return an object with their content, using their filenames (in camelCase) as keys.
/*jslint node:true, nomen:true, stupid:true*/
'use strict';
/**
* dependencies
*/
var fs = require('fs');
var path = require('path');
var s = require('string');
mixin template
script(id!=attributes.id, type="text/html")
if block
block