This file contains 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
const timer$ = timer(1000); | |
timer$.subscribe(t => console.time('RxJs')) | |
timer$.subscribe(t => console.timeEnd('RxJs')); | |
setTimeout(() => console.time('setTimeout'), 1000); | |
setTimeout(() => console.timeEnd('setTimeout'), 1000); |
This file contains 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
db.places.find( { loc : | |
{ $geoWithin : | |
{ $geometry : | |
{ type : "Polygon", | |
coordinates : [ [ [ 0 , 0 ] , [ 0 , 1 ] , [ 1 , 1 ] , [ 1 , 0 ] , [ 0 , 0 ] ] ] | |
} } } } ) |
This file contains 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
// Поиск по близости | |
db.places.find({ | |
loc: { | |
$near: [100, 100], | |
$maxDistance: 10 | |
} | |
}) | |
// Поиск по полигону | |
b.places.find({ |
This file contains 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
// Point | |
{ | |
name : "Timmy's Taco Truck", | |
loc : { | |
type : "Point", | |
coordinates : [ 37.7577 , -122.4376 ] | |
} | |
} | |
// Polygon (Square) |
This file contains 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
export default function typeOf(obj) { | |
return Object.prototype.toString.call(obj).slice(8, -1); | |
} |
This file contains 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
export default | |
function typeOf (obj) { | |
return Object.prototype.toString.call(obj).slice(8, -1); | |
} | |
// Unit tests | |
it('for Array', () => { | |
expect(typeOf([])).toBe('Array'); | |
}); |
This file contains 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
describe('EventModel', function() { | |
'use strict'; | |
var Fabric; | |
beforeEach(module('mean.trader')); | |
beforeEach(inject( | |
function($injector) { | |
Fabric = $injector.get('Fabric'); |
This file contains 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
describe('The test filter', function () { | |
'use strict'; | |
var $filter; | |
beforeEach(function () { | |
module('myTestFilterModule'); | |
inject(function (_$filter_) { | |
$filter = _$filter_; |
This file contains 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() { | |
'use strict'; | |
angular | |
.module('module') | |
.directive('directiveName', [directiveName]); | |
function directiveName() { | |
var directive = { |
This file contains 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 sleep(delay) { | |
var startTime = new Date(); | |
var endTime = null; | |
do { | |
endTime = new Date(); | |
} while ((endTime - startTime)); | |
} |
NewerOlder