Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!doctype html>
    <title>Google Maps Example</title>
    <script src=""></script>
    <link rel="stylesheet" href="" />
    <link rel="stylesheet" href="" />
    <div class="container">
      <h1>PubNub Google Maps Tutorial - Live Map Marker</h1>
      <div id="map-canvas" style="width:600px;height:400px"></div>

    <script> = 37.7850;
    window.lng = -122.4383;

    function circlePoint(time) {
      var radius = 0.01;
      var x = Math.cos(time) * radius;
      var y = Math.sin(time) * radius;
      return { + x, lng:window.lng + y};

    var map;
    var mark;

    var initialize = function() {
      map  = new google.maps.Map(document.getElementById('map-canvas'), {center:{lat:lat,lng:lng},zoom:12});
      mark = new google.maps.Marker({position:{lat:lat, lng:lng}, map:map});

    window.initialize = initialize;

    var redraw = function(payload) {
      lat =;
      lng = payload.message.lng;

      map.setCenter({lat:lat, lng:lng, alt:0});
      mark.setPosition({lat:lat, lng:lng, alt:0});

    var pnChannel = "map-channel";

    var pubnub = new PubNub({
      publishKey:   'YOUR_PUB_KEY',
      subscribeKey: 'YOUR_SUB_KEY'

    pubnub.subscribe({channels: [pnChannel]});

    setInterval(function() {
      pubnub.publish({channel:pnChannel, message:circlePoint(new Date().getTime()/1000)});
    }, 500);
    <script src=""></script>