This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var test = require('testling'); | |
| test('Math.abs performance', function (t) { | |
| var t0 = new Date; | |
| for (var i = 0; i < 100 * 1000; i++) Math.abs(i - 50 * 1000) | |
| t.log(new Date - t0); | |
| t.end(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var routes = { | |
| '/track' : { | |
| on: function() { | |
| alert('a'); | |
| }, | |
| '/:id' : { | |
| on: function(id){ | |
| alert('b'); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*! Cross-browser-compatible setZeroTimeout | |
| * | |
| * I took the original setZeroTimeout and made it cross-browser-compatible, using setTimeout(fn, 0) as a fallback in case postMessage is not supported. | |
| * Mathias Bynens <http://mathiasbynens.be/> | |
| * See <http://mathiasbynens.be/notes/settimeout-onload> | |
| * | |
| * Copyright statement below: | |
| * | |
| * See <http://dbaron.org/log/20100309-faster-timeouts> | |
| * By L. David Baron <dbaron@dbaron.org>, 2010-03-07, 2010-03-09 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(".content").weld( | |
| { | |
| some : "data", | |
| user : "tmpvar" | |
| }, | |
| { | |
| map : function(key, value) { | |
| $(this).attr("foo", value); // key is null if it is an array. | |
| }, | |
| method : "append" // defines what action the insert method should do. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function queryString2JSON() { | |
| var query = {} | |
| unescape(window.location.search).replace(/[^&\?]+/g, function(a, b) { | |
| var c = a.split("="); | |
| query[c[0]] = c[1]; | |
| }); | |
| return query; | |
| } |
NewerOlder