Skip to content

Instantly share code, notes, and snippets.

@elkhan
elkhan / ex1-prototype-style.js
Created August 8, 2022 18:04 — forked from getify/ex1-prototype-style.js
OLOO (objects linked to other objects) pattern explored (with comparison to the prototype style of the same code)
function Foo(who) {
this.me = who;
}
Foo.prototype.identify = function() {
return "I am " + this.me;
};
function Bar(who) {
Foo.call(this,"Bar:" + who);
@elkhan
elkhan / general_challenge.sql
Created November 28, 2020 20:55
UdemySQLbootcamp
SELECT COUNT(amount) FROM payment WHERE amount > 5.00;
SELECT COUNT(*) FROM payment WHERE amount > 5.00;
SELECT COUNT(*) FROM actor WHERE first_name LIKE 'P%';
SELECT DISTINCT(COUNT(district)) FROM address;
SELECT DISTINCT(district) FROM address;
SELECT COUNT(*) FROM film WHERE rating = 'R' AND replacement_cost BETWEEN 5 AND 15;
@elkhan
elkhan / promise.ts
Created October 13, 2019 19:33 — forked from ORESoftware/promise.ts
Promise implementation in JS. IRL the Promise implementation is in C++ land, but most JS implementations than native for whatever reason.
'use strict';
// note! run this with Node.js version 11, as queueMicrotask is only supported
// in Node.js version 11.
declare var queueMicrotask: any;
const CancelSymbol = Symbol('cancel');
const RejectSymbol = Symbol('reject');
@elkhan
elkhan / README.md
Created November 15, 2017 15:16 — forked from hofmannsven/README.md
My simply Git Cheatsheet