Skip to content

Instantly share code, notes, and snippets.

View noyesa's full-sized avatar

Andrew Noyes noyesa

View GitHub Profile
class Subclass {
callBaseSayHello() {
this.sayHello();
}
}
Object.setPrototypeOf(Subclass.prototype, baseProto);
function classify(mixin) {
const Surrogate = class {};
Surrogate.prototype = mixin;
return Surrogate;
}
const baseProto = {
sayHello() {
console.log('hello');
}
// Allowed.
class A {}
class B extends A {}
// Not allowed.
const A = {};
class B extends A {}
@noyesa
noyesa / gist:5700701
Last active December 18, 2015 00:59
var fs = require('fs');
if (process.argv.length < 3) {
console.log('JavaScript.js: the JavaScript to JavaScript transpiler.');
console.log('Please profile a source file.');
process.exit(1);
}
fs.readFile(process.argv[3], 'utf8', function(error, data) {
if (error) {
console.error(error.message);
/*
Copyright 2009 Andrew Noyes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@noyesa
noyesa / externalLinks.js
Created April 27, 2009 13:23
externalLinks function causes links to outside resources to open in a new window.
@noyesa
noyesa / array_merge.js
Created April 27, 2009 07:55
Implementation of array_merge for JavaScript
/**
* @fileoverview array_merge and supporting functions.
* Designed to mimic PHP's array_merge function, however
* this function also takes into account that objects are
* used in place of associative arrays in JavaScript.
* @author Andrew Noyes noyesa@gmail.com
*/
(function () {
/**