This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
f = número de casas decimais | |
d = separador de decimos (’,’ virgula por padrão) | |
t = separador de milhar (’.’ ponto por padrão) | |
*/ | |
String.prototype.currencyFormat = function (f, d, t) { | |
var n = (n = this.match(/\d/g)) ? n.join('').replace(/^0+/,'') : '0', f = (f) ? f : 2, d = (d) ? d : ',', t = (t) ? t : '.'; | |
if (n.length < f + 1) return '0' + d + ((n.length < f) ? new Array(f - n.length + 1).join('0') + n : n) | |
else return n.substr(0, n.length - f).split('').reverse().join('').match(/\d{1,3}/g).join(t).split('').reverse().join('') + d + n.substr(n.length - f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def diff(hash) | |
raise ArgumentError, 'Argument is not a Hash' unless hash.is_a? Hash | |
kkeys = [] | |
self.keys.each do |k| | |
diff = self[k].diff(hash[k]) if self[k].is_a? Hash and hash[k].is_a? Hash | |
kkeys << {k => diff} if diff and diff.size > 0 | |
end | |
diff = self.keys - hash.keys | |
kkeys << diff if diff and diff.size > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Valor do aparelho 7500 btus =/+ R$ 700 | |
Potência do aparelho: 754 w | |
Em kilowatt-hora: 0,754 kwh | |
Consumo durante 8 horas: 0,754 kwh * 8h = 6.032 kw | |
Consumo 8 horas durante 30 dias = 6.032 kw * 30 = 180.96 kw | |
Valor do kwh: R$ 0.56290 | |
180.96 kwh = +/- R$ 102 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $; | |
// Add jQuery | |
(function(){ | |
if (typeof unsafeWindow.jQuery == 'undefined') { | |
var GM_Head = document.getElementsByTagName('head')[0] || document.documentElement, | |
GM_JQ = document.createElement('script'); | |
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; | |
GM_JQ.type = 'text/javascript'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.AWTException; | |
import java.awt.MenuItem; | |
import java.awt.PopupMenu; | |
import java.awt.SystemTray; | |
import java.awt.TrayIcon; | |
import java.awt.event.MouseAdapter; | |
import java.awt.event.MouseEvent; | |
import java.io.File; | |
import java.io.IOException; | |
import javax.imageio.ImageIO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lista de documentários e filmes que considero como "obrigatórios", ou seja, todos deveriam assistir. | |
O critério usado para colocar um item na lista é: O documentário/filme mudou sua visão do mundo. | |
Documentários: | |
The Corporation - http://www.imdb.com/title/tt0379225/ | |
The Story of Stuff - http://www.storyofstuff.com/ | |
The Genius of Charles Darwin - http://en.wikipedia.org/wiki/The_Genius_of_Charles_Darwin | |
BBC - Horizon: How Many People Can Live on Planet Earth? - http://www.bbc.co.uk/programmes/b00pdjmk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.0.5' | |
gem 'pg' | |
gem 'inherited_resources', '~> 1.2.1' | |
gem 'haml' | |
gem 'formtastic', '~> 1.2.3' | |
gem 'capistrano' | |
gem 'clearance' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f $1 ] | |
then | |
sed "s/[[:blank:]]*$//" "$1" > "$1.tmp" | |
mv "$1.tmp" "$1" | |
else | |
echo "File $1 does not exist.\n" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" Convert values between RGB hex codes and xterm-256 color codes. | |
Nice long listing of all 256 colors and their codes. Useful for | |
developing console color themes, or even script output schemes. | |
Resources: | |
* http://en.wikipedia.org/wiki/8-bit_color | |
* http://en.wikipedia.org/wiki/ANSI_escape_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
OlderNewer