Skip to content

Instantly share code, notes, and snippets.

View mnaamani's full-sized avatar

Mokhtar Naamani mnaamani

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

/* test.pro
QT += core
QT -= gui
CONFIG += c++11
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
*/
@mnaamani
mnaamani / car.js
Last active August 29, 2015 14:24
//pseudo-classical
function Car(options) {
//if new keyword was used to invoke the constructor
//`this` would be an instance of Car.
if (!(this instanceof Car)) {
//ensure constructor is called with new keyword
return new Car(options)
}
this.instanceMethod = function(){};
module.exports = {
makeArrayBuffer:function(){
var arr = new ArrayBuffer(2);
arr[0]=1;arr[1]=2;
return arr;
},
makeUint8Array:function(n){
var arr = new ArrayBuffer(2);
arr[0]=3;arr[1]=4;
return new Uint8Array(arr);