Search Results

Search found 2 results on 1 pages for 'brainlikeadullpencil'.

Page 1/1 | 1 

  • gmaps4rails version 2 build method

    - by BrainLikeADullPencil
    I installed gmaps4rails for my Rails app, ran the generator, and required the two files like this in my application.js file, along with underscore.js //= require underscore //= require gmaps4rails/gmaps4rails.base //= require gmaps4rails/gmaps4rails.googlemaps adding, as instructed on github https://github.com/apneadiving/Google-Maps-for-Rails, these dependencies in layout.html.erb When I tried to create the demo map from the github page with this code, I got an error that the object doesn't have a build method. Uncaught TypeError: Object # has no method 'build' handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ markers = handler.addMarkers([ { "lat": 0, "lng": 0, "picture": { "url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png", "width": 36, "height": 36 }, "infowindow": "hello!" } ]); handler.bounds.extendWith(markers); handler.fitMapToBounds(); }); Indeed, when I look inside the base file that I require in the manifest file there is no build method for that object. How does one create a map in the new version for gmaps4rails?

    Read the article

  • accessing values in two dimensional arrays

    - by BrainLikeADullPencil
    In some code I'm trying to learn from, the Maze string below is turned into an array (code not shown for that) and saved in the instance variable @maze. The starting point of the Maze is represented by the letter 'A' in that Maze, which can be accessed at @maze[1][13]---row 1, column 13. However, the code I'm looking at uses @maze[1][13,1] to get the A, which you can see returns the same result in my console. If I do @maze[1][13,2], it returns the letter "A " with two blank spaces next to it, and so on. [13,3] returns "A " with three blank spaces. Does the 2 in [13,2] mean, "return two values starting at [1][13]? If so, why? Is this some feature of arrays or two dimensional arrays that I don't get? [20] pry(#<Maze>):1> @maze[1][13] => "A" [17] pry(#<Maze>):1> @maze[1][13,1] => "A" [18] pry(#<Maze>):1> @maze[1][13,2] => "A " [19] pry(#<Maze>):1> @maze[1][13,3] => "A " Maze String MAZE1 = %{##################################### # # # #A # # # # # # # # # ####### # ### # ####### # # # # # # # # # # # ##### # ################# # ####### # # # # # # # # # ##### ##### ### ### # ### # # # # # # # # # # # # B# # # # # # # # ##### ##### # # ### # # ####### # # # # # # # # # # # # # # ### ### # # # # ##### # # # ##### # # # # # # # # #####################################}

    Read the article

1