Demonstration of phenomenon, when caller cumulative time can be less than the callee, given it's the only caller. This may happen if callee is generator and caller returns callee object as is. Then profiler sees a lot of time spent in callee and almost no time at caller.
Implementation of algorithm for points compression. For more details see the post: http://barahilia.github.io/blog/computers/2014/10/11/points-on-plane-compression.html.
Given an array of 2D points, each coordinate a 16-bit integer, split them all to squares on 256x256 grid and encode each coordinate with one byte only.
This gits features encoding functions, unit tests and a sample file.
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
// This is a workaround for R# complaining on undefined global variables. | |
// In practice they come from and are defined by Jasmine and Protractor | |
// frameworks, so are not a real issues. | |
// Jasmine | |
var describe = function () { }; | |
var beforeEach = function () { }; | |
var afterEach = function () { }; |
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
Build with: `g++ test.cpp && ./a.out` | |
For editing two files in `vim` run command `:vsplit tree.h`. | |
http://www.cs.swarthmore.edu/help/vim/windows.html |
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
Allows match JSON objects by pattern. Intended for APIs comparison and verification. | |
E.g.: | |
compare( | |
{ a: 1, b: ['x', 'y'] }, // pattern | |
{ a: 42, b: ['first', 'second', 'any', 'last'] } // object for check | |
); |
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 system = require('system'), | |
env = system.env; | |
/** | |
* Wait until the test condition is true or a timeout occurs. Useful for waiting | |
* on a server response or for a ui change (fadeIn, etc.) to occur. | |
* | |
* @param testFx javascript condition that evaluates to a boolean, | |
* it can be passed in as a string (e.g.: "1 == 1" or "$('#bar').is(':visible')" or | |
* as a callback function. |
NewerOlder