Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?
|
| import ImageStatic from 'ol/source/ImageStatic'; | |
| import ImageCanvas from 'ol/ImageCanvas'; | |
| import EventType from 'ol/events/EventType'; | |
| import {listen} from 'ol/events'; | |
| class Canvas extends ImageStatic { | |
| constructor(options) { | |
| super(options); | |
| this.image_ = new ImageCanvas(options.imageExtent, 1, 1, options.canvas); | |
| listen(this.image_, EventType.CHANGE, this.handleImageChange, this); |
Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?
|
| // Base tile size used in Google Javascript SDK | |
| const GOOGLE_BASE_TILE_SIZE = 256; | |
| // MercatorProjection implements the Projection interface defined in Google Maps | |
| // Javascript SDK. | |
| // | |
| // Google Maps Javascript SDK docs: | |
| // https://developers.google.com/maps/documentation/javascript/maptypes#WorldCoordinates | |
| // | |
| // For more details about the convertions see |
| const readline = require('readline') | |
| const blank = '\n'.repeat(process.stdout.rows) | |
| console.log(blank) | |
| readline.cursorTo(process.stdout, 0, 0) | |
| readline.clearScreenDown(process.stdout) |
| <?php | |
| error_reporting( error_reporting() & ~E_NOTICE ); // evil | |
| // config | |
| $enable_jsonp = false; | |
| $enable_native = false; | |
| $valid_url_regex = '/.*/'; | |
| // ############################################################################ |
| 'use strict'; | |
| const X = [0.1, 0.5, 0.9, 1.3, 1.7]; | |
| const Y = [-2.3026, -0.69315, -0.10536, 0.26236, 0.53063]; | |
| const x = 0.8; | |
| // const n = 3; | |
| // var splines = new Array(X.length).fill({a:null,b:null,c:null,d:null,x:null}); | |
| var splines = []; | |
| for (let i =0; i < X.length; i++){ | |
| splines.push({a:null,b:null,c:null,d:null,x:null}); |
| //jQuery and Webtorrent (https://webtorrent.io/) dependencies | |
| var json_source_url = ""; //json data source | |
| var filename = ""; //filename.json | |
| $.getJSON(json_source_url, function( data ) { | |
| var jsonstring = JSON.stringify(data); | |
| var blob = new Blob([jsonstring], {type: "application/json"}); | |
| var client = new WebTorrent() |
| ZigZag-Encoding | |
| --------------- | |
| Maps negative values to positive values while going back and | |
| forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...) | |
| (i >> bitlength-1) ^ (i << 1) | |
| with "i" being the number to be encoded, "^" being | |
| XOR-operation and ">>" would be arithemtic shifting-operation |
| window.cancelRequestAnimFrame = ( function() { | |
| return window.cancelAnimationFrame || | |
| window.webkitCancelRequestAnimationFrame || | |
| window.mozCancelRequestAnimationFrame || | |
| window.oCancelRequestAnimationFrame || | |
| window.msCancelRequestAnimationFrame || | |
| clearTimeout | |
| } )(); | |
| for (var i = 1; i < 99999; i++) { |
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
| Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |