Skip to content

Instantly share code, notes, and snippets.

View theleancoder's full-sized avatar

Ankit Singh theleancoder

  • .na
  • Gurgaon, India
View GitHub Profile
#include<iostream>
#include<list>
using namespace std;
class Graph
{
int V;
list<int> *adj;
public:
Graph(int V)
// output
hello
world
setTimeout(function() {
console.log("world");
}, 2000)
console.log("hello");
// extract a core module like this
var http = require('http);
// extract a user defined module like this
var something = require('./folder1/folder2/folder3/something.js');
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function () {};
F.prototype = o;
return new F();
};
var otherPerson = Object.create(person);
// take order for table 1 and move on...
orderNonBlocking(['Coke', 'Iced Tea'], function(drinks){
return serveOrder(drinks);
});
// take order for table 2 and move on...
orderNonBlocking(['Beer', 'Whiskey'], function(drinks){
return serveOrder(drinks);
});
// take order for table 1 and wait...
var order1 = orderBlocking(['Coke', 'Iced Tea']);
// once order is ready, take order back to table.
serveOrder(order1);
// once order is delivered, move on to another table.
// take order for table 2 and wait...
var order2 = orderBlocking(['Coke', 'Water']);
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function () {};
F.prototype = o;
return new F();
};
var otherPerson = Object.create(person);
// output
hello
world
setTimeout(function() {
console.log("world");
}, 2000)
console.log("hello");