Skip to content

Instantly share code, notes, and snippets.

View ricardobeat's full-sized avatar

Ricardo Tomasi ricardobeat

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<!--Site-->
<div id="site">
<!--container-->
<div id="container">
function testAttributeSupport() {
var head = document.getElementsByTagName('head')[0];
var style = document.createElement('style');
var s = 'div[id] {}';
style.type = 'text/css';
if (style.styleSheet)
style.styleSheet.cssText = s;
else
style.appendChild( document.createTextNode(s) );
http = new Server(8001);
function read(client) //returns true when a command is ready
{
var msg = ""
while (client.canRead)
{
let c = client.read(1)
if (!c.length) return false //dead connection
if (c == '\r') continue
w = new Stream('net://'+jsArguments[0]);
r = true;
while(r){
sleep(500);
txt = system.stdin.readLine();
if (txt) {
w.writeln( txt );
}
if (txt == 'quit'){
r = false;
$('#videos a').click(function(){
var video_url = $(this).attr('href');
// o OOHembed retorna o HTML do tuiube embed
$.getJSON('http://oohembed.com/oohembed?callback=?', {
url: video_url,
format: 'json',
maxwidth: $(window).width()-160,
maxheight: $(window).height()-160
}, function(response){
$.fn.colorbox({
/Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/command.js:117
throw err;
^
TypeError: In main.coffee, Object #wtf
x = 1+1 has no method 'replace'
at Lexer.tokenize (/Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/lexer.js:44:19)
at Object.compile (/Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/coffee-script.js:34:34)
at Object.run (/Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/coffee-script.js:58:25)
at compile_script (/Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/command.js:102:29)
at /Users/ricardobeat/.seeds/packages/coffee-script/0.6.1/lib/command.js:70:18
@ricardobeat
ricardobeat / coordenadas_estados_BR.js
Created November 12, 2010 20:46
Coordenadas dos estados do brasil (centralizado, não capitais)
{
AC: [ -8.77, -70.55]
, AL: [ -9.71, -35.73]
, AM: [ -3.07, -61.66]
, AP: [ 1.41, -51.77]
, BA: [-12.96, -38.51]
, CE: [ -3.71, -38.54]
, DF: [-15.83, -47.86]
, ES: [-19.19, -40.34]
, GO: [-16.64, -49.31]
@ricardobeat
ricardobeat / tempo-relativo.js
Created December 10, 2010 16:22
tempo relativo / relative time
function tempoRelativo(_date, showSeconds){
// offset a partir da data atual em segundos
var s = ~~( (+new Date-Date.parse(_date)) / 1000 );
// encontrar unidade de tempo
var un = (s<60) ? 'segundo'
: (s /= 60)<60 ? 'minuto'
: (s /= 60)<24 ? 'hora'
: (s /= 24)<30.4 ? 'dia'
: (s /= 30.4)<365 ? 'mes'
: 'ano';
# Textmate essential bundles
cd ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles
# mkdir -p cd /Applications/TextMate.app/Contents/SharedSupport/Bundles
git clone git://github.com/protocool/ack-tmbundle.git Ack.tmbundle
git clone git://github.com/textmate/ruby-haml.tmbundle.git
git clone git://github.com/seaofclouds/sass-textmate-bundle.git "Ruby Saas.tmbundle"
git clone git://github.com/bmabey/cucumber-tmbundle.git Cucumber.tmbundle
git clone git://github.com/karnowski/blue-ridge-tmbundle.git JavaScript\ Blue\ Ridge.tmbundle
git clone git://github.com/johnmuhl/nginx-tmbundle.git nginx.tmbundle
@ricardobeat
ricardobeat / ie input types.js
Created December 22, 2010 20:14
Adds classes to input elements in Internet Explorer according to it's type
// ================================================
// workaround para seletor de atributos type (ex: [type=text]) no IE6
// cria classe type_valorDoAtributo
// repetir no CSS (não pode estar no mesmo seletor):
// input[type=text] { x:y; }
// input.type_text { x:y; }
// -
(function(){
if (! ($.browser.msie && $.browser.version < 7) )
return false;