This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let HEAP = []; | |
const A = { | |
language: 'JavaScript' | |
}; | |
HEAP.push(A); | |
const root = () => HEAP[0]; |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Jimp v0.2.28 | |
https://github.com/oliver-moran/jimp | |
Ported for the Web by Phil Seaton | |
The MIT License (MIT) | |
Copyright (c) 2014 Oliver Moran | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const some_module = require('some_module') | |
/** | |
* require('some_module') calls Module._load | |
* | |
* Module._load then tries to load the module with a filename (also save it to the cache) using module.load(filename) | |
* | |
* module.load(filename), given a filename, passes it to the proper extension handler ('.js', '.json') | |
* | |
* If there were any errors when loading the file, it deletes the file from the cache (delete Module._cache[filename]) and throws an error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Polyfill indexOf. */ | |
var indexOf; | |
if (typeof Array.prototype.indexOf === 'function') { | |
indexOf = function (haystack, needle) { | |
return haystack.indexOf(needle); | |
}; | |
} else { | |
indexOf = function (haystack, needle) { | |
var i = 0, length = haystack.length, idx = -1, found = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TrafficLight = function () { | |
var count = 0; | |
var currentState = new Red(this); | |
this.change = function (state) { | |
// limits number of changes | |
if (count++ >= 10) return; | |
currentState = state; | |
currentState.go(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Click() { | |
this.handlers = []; // observers | |
} | |
Click.prototype = { | |
subscribe: function(fn) { | |
this.handlers.push(fn); | |
}, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is sample code which represents command pattern. | |
* A command pattern basically instructs a function to perform some actions. | |
* It is a function call wrapped in an object and very useful where we want a layer of abstraction between the action creator and the action to be performed | |
*/ | |
// Action | |
function add(a, b) { | |
return a + b | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Grouping extends Expression { | |
constructor(expression) { | |
super() | |
this.expression = expression | |
} | |
handle(visitor) { | |
return visitor.visitGroupingExpression(this) | |
} | |
} |
NewerOlder