Skip to content

Instantly share code, notes, and snippets.

View ilyachenko's full-sized avatar
😀
Happy

Illia Diachenko ilyachenko

😀
Happy
View GitHub Profile
@ilyachenko
ilyachenko / cumulative.js
Last active August 29, 2015 14:00
CumulativeList
var cumulativeList = [
{min: 0.01, max: 9.99, title: '0.01-9.99'},
{min: 10, max: 19.99, title: '10-19.99'},
{min: 20, max: 29.99, title: '20-39.99'},
{min: 40, max: 99.99, title: '40-99.99'},
{min: 100, max: 199.99, title: '100-199.99'},
{min: 200, max: Infinity, title: '200+'}
];
/**
@ilyachenko
ilyachenko / sleep.js
Last active September 29, 2018 08:06
Javascript synchronous sleep function
function sleep(delay) {
var startTime = new Date();
var endTime = null;
do {
endTime = new Date();
} while ((endTime - startTime));
}
(function() {
'use strict';
angular
.module('module')
.directive('directiveName', [directiveName]);
function directiveName() {
var directive = {
describe('The test filter', function () {
'use strict';
var $filter;
beforeEach(function () {
module('myTestFilterModule');
inject(function (_$filter_) {
$filter = _$filter_;
describe('EventModel', function() {
'use strict';
var Fabric;
beforeEach(module('mean.trader'));
beforeEach(inject(
function($injector) {
Fabric = $injector.get('Fabric');
export default
function typeOf (obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
}
// Unit tests
it('for Array', () => {
expect(typeOf([])).toBe('Array');
});
@ilyachenko
ilyachenko / typeOf.js
Last active June 21, 2016 13:43
Showing the top six matches.
export default function typeOf(obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
}
// Point
{
name : "Timmy's Taco Truck",
loc : {
type : "Point",
coordinates : [ 37.7577 , -122.4376 ]
}
}
// Polygon (Square)
// Поиск по близости
db.places.find({
loc: {
$near: [100, 100],
$maxDistance: 10
}
})
// Поиск по полигону
b.places.find({
db.places.find( { loc :
{ $geoWithin :
{ $geometry :
{ type : "Polygon",
coordinates : [ [ [ 0 , 0 ] , [ 0 , 1 ] , [ 1 , 1 ] , [ 1 , 0 ] , [ 0 , 0 ] ] ]
} } } } )