Skip to content

Instantly share code, notes, and snippets.

View alex-mtx's full-sized avatar

Alexander Molinari alex-mtx

View GitHub Profile
@getify
getify / gist:5226305
Last active January 7, 2024 11:59
playing around with an `Object.make()` helper
// `Object.make(..)` is a helper/wrapper for `Object.create(..)`. Both create a new
// object, and optionally link that new object's `[[Prototype]]` chain to another object.
//
// But `Object.make(..)` makes sure the new object always has a `__proto__` property
// (even a null one) and delegation to a `isPrototypeOf(..)` method, both of which are
// missing from the bare object (aka "Dictionary") created by `Object.create(null)`.
//
// `isPrototypeOf()` is put on a extra object that your created object can delegate to,
// if any only if you create an empty object (by not passing a `linkTo`) that otherwise
// wouldn't have access to `isPrototypeOf()`.
@getify
getify / ex1-prototype-style.js
Last active January 7, 2024 11:58
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);
@scottoffen
scottoffen / ContentType.cs
Last active November 23, 2022 04:11
C# ContentType Enum full source code
using System;
using System.Reflection;
namespace Grapevine
{
public enum ContentType
{
[Metadata(Value = "application/x-authorware-bin", IsBinary = true)]
AAB,
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing