This example shows how to create a Leaflet map with a basemap and an empty CartoDB.js layer. Once the layer is created a function is attached the event of the layers selector checkboxes so on any state change, the sublayers are removed and recreated according to the user selection.
source 'https://rubygems.org' | |
# default gems here | |
#--------------------------- | |
# add paperclip and bootstrap | |
gem "paperclip", "~> 4.1" | |
gem 'bootstrap-sass', '~> 3.1.1' |
require 'cucumber' | |
require 'selenium-webdriver' | |
# require 'cukehub' # optional, but recommended. See cukehub.com for more details | |
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { binary: "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary", | |
args: [ "--headless" ]}) | |
Before do | |
@browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps | |
end |
On this map we create two CartodB layers, one of them is built with two sublayers. In order to control when they are added to the map, we save the promises objects and use the jQuery.when function to execute the code to add the layers to the map when both promises are executed.
The MIT License (MIT)
Copyright (c) 2015 Juan Cruz-Benito. http://juancb.es
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR I
<!doctype html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<base href="/"> | |
<title></title> |
<style> | |
* { | |
font-family: Verdana; | |
} | |
.node { | |
border: solid 1px white; | |
font: 10px sans-serif; | |
line-height: 12px; |
Promise = require('bluebird') | |
var A = function() { | |
return new Promise(function(resolve, reject) { | |
var result = 'A is done' | |
console.log(result) | |
resolve(result); | |
}) |
My goal here was the create a routable graph for Chicago.
I used Ubuntu 12.04LTS on an m2.4xlarge just to be sure memory wasn't too much of an issue.
Start a screen
session and start downloading an OSM extract (I used this extract of Illinois). In another screen I did the following:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get -y install git make cmake build-essential \
Using during Hartl rails 4.0 guide (http://ruby.railstutorial.org/chapters)
group :development, :test
gem 'guard-rspec'
gem 'guard-livereload'
gem 'spork-rails', github: 'sporkrb/spork-rails' # rubygems version not rails 4 compatible
gem 'guard-spork'