Skip to content

Instantly share code, notes, and snippets.

Roberto Pepato rpepato

  • Pepato
  • São José dos Campos, SP - Brazil
View GitHub Profile
@rpepato
rpepato / fibo_ruby.rb
Created Oct 16, 2015
Memoization in ruby
View fibo_ruby.rb
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 Aug 29, 2015
Simple demonstration of geocode dijit usage with ArcGIS Javascript API
View geocode.html
<!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 Aug 29, 2015
O que há de novo para desenvolvedores Esri? - Presentation Links
View esri_links
@rpepato
rpepato / routes.js
Last active Aug 29, 2015
Building a route with dynamic barriers using the Esri ArcGIS Javascript API
View routes.js
<!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 Mar 9, 2013
Algorithm to calculate the gray code for a specified number of bits, using recursion in ruby
View gist:5124032
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 Aug 9, 2011
Add a simple map from Google Maps to a web application
View SampleWebMapping.html
<!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">
You can’t perform that action at this time.