Skip to content

Instantly share code, notes, and snippets.

@kybernetikos
Created May 15, 2013 23:37
Show Gist options
  • Save kybernetikos/5588309 to your computer and use it in GitHub Desktop.
Save kybernetikos/5588309 to your computer and use it in GitHub Desktop.
An example of some js compiled from coffeescript. See https://gist.github.com/josh/2553381 The sourceMappingURL is an entire source map that includes the coffeescript source, encoded in a base64 data uri. This could be generated programmatically. Evalling a string containing this gists contents in chrome canary puts you into the debugger showing…
// Generated by CoffeeScript 1.3.1
(function() {
var cubes, list, math, num, number, opposite, race, square,
__slice = [].slice;
number = 42;
opposite = true;
if (opposite) {
number = -42;
}
square = function(x) {
return x * x;
};
list = [1, 2, 3, 4, 5];
math = {
root: Math.sqrt,
square: square,
cube: function(x) {
return x * square(x);
}
};
race = function() {
var runners, winner;
winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
return print(winner, runners);
};
if (typeof elvis !== "undefined" && elvis !== null) {
alert("I knew it!");
}
debugger;
cubes = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = list.length; _i < _len; _i++) {
num = list[_i];
_results.push(math.cube(num));
}
return _results;
})();
}).call(this);
//@ sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLA0KImZpbGUiOiJleGFtcGxlLmpzIiwNCiJzb3VyY2VSb290IjoiaHR0cDovL2xvY2FsaG9zdDo1MDUwL3dvcmtzcGFjZXMvaW50ZWxsaWoxMi9zcmMtbWFwL2R5bmFtaWMvIiwNCiJzb3VyY2VzIjpbImV4YW1wbGUuY29mZmVlIl0sDQoic291cmNlc0NvbnRlbnQiOlsiIyBBc3NpZ25tZW50OlxubnVtYmVyID0gNDJcbm9wcG9zaXRlID0gdHJ1ZVxuXG4jIENvbmRpdGlvbnM6XG5udW1iZXIgPSAtNDIgaWYgb3Bwb3NpdGVcblxuIyBGdW5jdGlvbnM6XG5zcXVhcmUgPSAoeCkgLT4geCAqIHhcblxuIyBBcnJheXM6XG5saXN0ID0gWzEsIDIsIDMsIDQsIDVdXG5cbiMgT2JqZWN0czpcbm1hdGggPVxuICByb290OiBNYXRoLnNxcnRcbiAgc3F1YXJlOiBzcXVhcmVcbiAgY3ViZTogKHgpIC0%2BIHggKiBzcXVhcmUgeFxuXG4jIFNwbGF0czpcbnJhY2UgPSAod2lubmVyLCBydW5uZXJzLi4uKSAtPlxucHJpbnQgd2lubmVyLCBydW5uZXJzXG5cbiMgRXhpc3RlbmNlOlxuYWxlcnQgXCJJIGtuZXcgaXQhXCIgaWYgZWx2aXM%2FXG5cbiMgQXJyYXkgY29tcHJlaGVuc2lvbnM6XG5jdWJlcyA9IChtYXRoLmN1YmUgbnVtIGZvciBudW0gaW4gbGlzdCkiXSwNCiJuYW1lcyI6WyJudW1iZXIiLCJvcHBvc2l0ZSIsInNxdWFyZSIsImxpc3QiLCJtYXRoIiwicmFjZSIsImN1YmVzIl0sIm1hcHBpbmdzIjoiOzs7OztFQUNBQTs7RUFDQUM7O0VBR0E7SUFBQTs7O0VBR0FDO0lBQVM7OztFQUdUQzs7RUFHQUM7SUFDRTtJQUNBO0lBQ0E7TUFBUTs7OztFQUdWQzs7O0lBQ0U7OztFQUdGO0lBQUE7OztFQUdBQzs7O0lBQVE7O01BQUEifQ%3D%3D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment