Skip to content

Instantly share code, notes, and snippets.

View rpepato's full-sized avatar

Roberto Pepato rpepato

  • Pepato
  • São José dos Campos, SP - Brazil
View GitHub Profile
@rpepato
rpepato / fibo_ruby.rb
Created October 16, 2015 20:07
Memoization in ruby
require 'rubygems'
require 'benchmark'
def fibonacci(n)
return n if n <= 1
fibonacci( n - 1 ) + fibonacci( n - 2 )
end
@cache = [0,1]
def fibo(n)
@rpepato
rpepato / geocode.html
Last active August 29, 2015 14:03
Simple demonstration of geocode dijit usage with ArcGIS Javascript API
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>ArcGIS API for JavaScript | Simple Geocoding</title>
<script src="http://js.arcgis.com/3.9/"></script>
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
<style>
html, body, #map {
@rpepato
rpepato / esri_links
Last active August 29, 2015 14:00
O que há de novo para desenvolvedores Esri? - Presentation Links
@rpepato
rpepato / routes.js
Last active August 29, 2015 13:56
Building a route with dynamic barriers using the Esri ArcGIS Javascript API
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Rotas Parametrizáveis</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
@rpepato
rpepato / gist:5124032
Created March 9, 2013 12:31
Algorithm to calculate the gray code for a specified number of bits, using recursion in ruby
def gray_code_for(number_of_bits)
if number_of_bits == 1
return %w[0 1]
end
ordered = gray_code_for(number_of_bits - 1)
reversed = ordered.reverse
ordered.map! { |item| "0#{item}"}
reversed.map! { |item| "1#{item}"}
ordered + reversed
end
@rpepato
rpepato / SampleWebMapping.html
Created August 9, 2011 12:36
Add a simple map from Google Maps to a web application
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=28&key=xyz" type="text/javascript"> <!-- the required library for google maps usage -->
</script>
</head>
<body>
<div id="map" style="width: 500px; height:400px"></div>
<script type="text/javascript">