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
require 'net/http' | |
require 'nokogiri' | |
$eventos = { '2008' => '159', '2009' => '280', '2010' => '396' } | |
unless $eventos.keys.include?(ARGV[0]) | |
STDERR.puts "Uso: #{$0} <#{$eventos.keys.sort.join('|')}>" | |
exit(2) | |
end |
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
require 'yaml' | |
yaml = YAML.load(STDIN.read) | |
columns = yaml.values.first.keys.sort | |
puts "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" | |
puts "<html lang=\"en-US\" xml:lang=\"en-US\" xmlns=\"http://www.w3.org/1999/xhtml\">" | |
puts " <head>" | |
puts " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" |
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
# coding: utf-8 | |
require 'rubygems' | |
require 'prawn' | |
require 'benchmark' | |
class Danfe | |
# Largura mínima da barra deve ser de 6 cm / 297 = 0,02 cm = 0,57 pt. A largura que usaremos | |
# será 0,70 pt = 0,025 cm = 7,33 cm / 297. |
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
require 'rubygems' | |
require 'prawn' | |
$pdf = Prawn::Document.new(:page_size => 'A4') | |
$pdf.line_width = 0.3 | |
def test_box(origin, angle) | |
$pdf.translate(*origin) do | |
$pdf.rotate(angle, :origin => [0, 0]) do | |
$pdf.stroke do |
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
#define LUA_LIB | |
#include <windows.h> | |
#include "lua.h" | |
#include "lauxlib.h" | |
#include "ldiriterator.h" | |
typedef struct DirectoryIterator | |
{ | |
HANDLE handle; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<style type="text/css"> | |
html { height: 100% } | |
body { height: 100%; margin: 0; padding: 0 } | |
#map_canvas { height: 100% } | |
</style> |
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
module Astar | |
def sort_walking_neighbors(origin, routes) | |
result = [] | |
routes.each_with_index do |r, i| | |
result += r.map do |p| | |
[i, p] | |
end | |
end | |
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
require 'net/http' | |
require 'uri' | |
require 'nokogiri' | |
require 'iconv' | |
require 'yaml' | |
uri = URI("http://urbs-web.curitiba.pr.gov.br/centro/conteudo_lista_linhas.asp?l='n'") | |
response = Net::HTTP.start(uri.host, uri.port) do |http| | |
http.get(uri.request_uri).body |
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
x1, y1 = 1.0, 2.2 | |
x2, y2 = 5.0, 3.3 | |
x3, y3 = -10.0, -100.0 | |
dx12 = x1 - x2 | |
dy12 = y1 - y2 | |
den = dx12 ** 2 + dy12 ** 2 | |
x4 = (x3 * dx12 ** 2 - dy12 * (x1 * (y2 - y3) - x2 * (y1 - y3))) / den | |
y4 = (y3 * dy12 ** 2 - dx12 * (y1 * (x2 - x3) - y2 * (x1 - x3))) / den |
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
def rad(a) | |
a * Math::PI / 180.0 | |
end | |
def deg(a) | |
a * 180.0 / Math::PI | |
end | |
class Vector |
OlderNewer