Skip to content

Instantly share code, notes, and snippets.

View dbouwman's full-sized avatar
😎
Hubbin it up @ Esri

Dave Bouwman dbouwman

😎
Hubbin it up @ Esri
View GitHub Profile
@dbouwman
dbouwman / async.example.js
Created July 26, 2013 13:22
Example Jasmine Async Test
describe("Example Async Test", function() {
var value, flag;
it("should do something that has a callback", function() {
//Specs are written by defining a set of blocks with calls to runs,
//which usually finish with an asynchronous call.
var ourObj = new SomeObject();
runs(function() {
flag = false;
//simple callback that will set our "flag"
@dbouwman
dbouwman / maphelper.js
Created July 26, 2013 13:30
Helper that injects a div into the page creates an esri.Map and fires a callback when that map is loaded.
//helper that injects a div, creates a map and
//fires a callback when it's ready to roll
function createTestMap(divId, mapReadyCallback){
$("body").append("<div id='" + divId + "' style='height:400px;width:400px'></div>");
var map = new esri.Map(divId,{
basemap:"topo",
center:[-122.45,37.75],
zoom:13,
sliderStyle:"small"
});
@dbouwman
dbouwman / example-test.js
Last active December 20, 2015 06:49
Example of a real test using the helper
describe('the map configurator', function(){
it('should add specified layers as dynamic services', function(){
var data = getJSONFixture('layers-only.json');
var flag,localMap,divId = 'map-layers-test';
runs(function(){
var flagCallback = function(result){
flag = true;
};
var actionCallback = function(map){
localMap = map;
@dbouwman
dbouwman / layers-only.json
Created July 26, 2013 13:46
Example of a json fixture
{
"layers":[
{
"id": "RedFlagWarnings",
"url": "http://svinetfc3.fs.fed.us/ArcGIS_NPSG/rest/services/NPSG/Fire_Watches_Warnings/MapServer",
"visibleLayers": [1],
"visible": true,
"opacity": 0.8
},
{
@dbouwman
dbouwman / jasmine-active-specs.js
Created October 30, 2013 17:44
jasmine-active-specs.js
module.exports = {
specs: [
'./spec/modules/items/show/show_controller.spec.js',
'./spec/modules/items/show/show_view.spec.js'
],
}
.container{
position:absolute;
width:100%;
/*overflow:hidden; */
}
.layout {
position:absolute;
width:90%;
height:100%;
@dbouwman
dbouwman / err.txt
Created January 6, 2014 18:26
rails error
11:20:04 db-composer (refactor-backend) $ bundle exec rake rails:update:bin
rake aborted!
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/chain-0.0.3/lib/chain/url.rb:68: syntax error, unexpected tPOW, expecting ')'
method_missing(nil, path, **params)
^
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/chain-0.0.3/lib/chain/url.rb:92: syntax error, unexpected $end, expecting keyword_end
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/Users/dbouwman/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
12:14:38 db-composer (refactor-backend) $ rbenv install 2.0.0-p195Downloading ruby-2.0.0-p195.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/0672e5af309ae99d1703d0e96eff8ea5
Installing ruby-2.0.0-p195...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/d8/rshjcmrd3_dcshnzs8f0hw7h0000gp/T/ruby-build.20140106121527.79632
Results logged to /var/folders/d8/rshjcmrd3_dcshnzs8f0hw7h0000gp/T/ruby-build.20140106121527.79632.log
Last 10 log lines:
@dbouwman
dbouwman / MapServiceLayerAsFeatureLayer.html
Last active January 2, 2016 18:59 — forked from anonymous/jsbin.ONIBUtI.html
Example showing how to use a map service layer as a Feature Layer
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="MapService Layer as Feature Layer" />
<title>Create a Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<style>
@dbouwman
dbouwman / FeatureLayerScaleHack.html
Last active January 2, 2016 18:59 — forked from anonymous/jsbin.EXEwADO.html
How to get a feature layer with min/max scales to draw at any scale
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Feature Layer w/ min/max scale hack" />
<title>Create a Map</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<style>