Skip to content

Instantly share code, notes, and snippets.

View amulyakashyap09's full-sized avatar
🎯
Focusing

Amulya Kashyap amulyakashyap09

🎯
Focusing
  • Greater Noida
View GitHub Profile
@learncodeacademy
learncodeacademy / generators.md
Last active January 7, 2024 11:58
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
@wbzyl
wbzyl / 2dqueries.js
Created May 10, 2011 10:51 — forked from glyphobet/2dqueries.js
Example showing that MongoDB uses native units for regular 2d queries, and radians for spherical 2d queries
> db.dropDatabase();
{ "dropped" : "test", "ok" : 1 }
>
> // These points are one degree apart, which (according to Google Maps) is about 110 km apart
> // at this point on the Earth.
> db.points.insert({location: [-122, 37]});
> db.points.insert({location: [-122, 38]});
> db.points.ensureIndex({location:"2d"});
>
>