Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
== Google Maps for Rails {}[https://pledgie.com/campaigns/23367]
{}[http://travis-ci.org/apneadiving/Google-Maps-for-Rails] {}[https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails] {}[http://badge.fury.io/rb/gmaps4rails] {}[http://coderwall.com/apneadiving] {}[https://bitdeli.com/free]
Gmaps4rails is developed to simply create a Google Map with overlays (markers, infowindows...). Yet it's backed on a very flexible codebase which could be prone to accept other map providers.
Use it with any Ruby app (I guess you could simply take the js anywhere if you like).
Here is a {quick tutorial on youtube}[http://www.youtube.com/watch?v=R0l-7en3dUw&feature=youtu.be], and my {presentation on speaker deck}[https://speakerdeck.com/apneadiving/gmaps4rails].
For live examples, {see here}[http://apneadiving.github.io/].
== A note for < 2.x users
Google-Maps-for-Rails-2.0 is an important rewrite to keep the minimum code and features. If you're migrating from previous versions, you may want to read the {rational about it}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Why-but-why%3F].
== Requirements
Gemfile
gem 'gmaps4rails'
HTML
Add a div to bear your map, example:
<div style='width: 800px;'>
<div id="map" style='width: 800px; height: 400px;'></div>
</div>
2) Javascript Dependencies:
Insert google scripts in your dom:
<script src="//maps.google.com/maps/api/js?v=3.13&sensor=false&libraries=geometry" type="text/javascript"></script>
<script src='//google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js' type='text/javascript'></script>
You'll require underscore.js too, see here: {http://underscorejs.org/}[http://underscorejs.org/] (lo-dash
is compatible too, your choice!).
If you have the asset pipeline, add this:
//= require underscore
//= require gmaps/google
If you don't have asset pipeline, you'll need to import the js OR coffee files:
rails g gmaps4rails:copy_js
rails g gmaps4rails:copy_coffee
4) Javascript code:
Create your map:
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();
});
== Generating JSON
In your controller:
@users = User.all
@hash = Gmaps4rails.build_markers(@users) do |user, marker|
marker.lat user.latitude
marker.lng user.longitude
end
In your view:
markers = handler.addMarkers(<%=raw @hash.to_json %>);
== Easily customizable
You can change almost everything with a few lines of code. {See details here}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Change-handler-behavior]
== Options
Markers with Info window, Custom Picture, RichMarkers (make your own markers with custom html)
Circles, Polylines, Polygons, Kml
Refresh your map on the fly with Javascript (and Ajax)
{More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]
== Todo?
Feel free to contact us, you have your say.
== Copyright MIT license.
Author: Benjamin Roth
{Contributors}[https://github.com/apneadiving/Google-Maps-for-Rails/graphs/contributors]
FAQs
Unknown package
We found that gmaps4rails demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.