Skip to content

Instantly share code, notes, and snippets.

View challenges-1-to-5.js
init: function(elevators, floors) {
var waiting = [];
elevators.forEach(function (elevator) {
elevator.on("idle", function() {
var i = waiting.length;
while (i-- > 0) {
eridal /
Last active Mar 9, 2022
Java to PHP Compilation
package j2p;
import japa.parser.JavaParser;
import japa.parser.ParseException;
import japa.parser.ast.CompilationUnit;
import japa.parser.ast.ImportDeclaration;
import japa.parser.ast.PackageDeclaration;
import japa.parser.ast.body.BodyDeclaration;
import japa.parser.ast.body.ClassOrInterfaceDeclaration;
import japa.parser.ast.body.FieldDeclaration;
eridal /
Last active Aug 29, 2015
PHP to Java persistent process comunication
import java.util.Scanner;
class Java {
public static void main(String[] args) {
Scanner s = new Scanner(;
while (s.hasNextInt()) { // <-- blocking read
int i = s.nextInt();
  • In the world of open-source development where most of the code is shared, code clarity and readability is important.
  • Object-oriented code architecture allows for much higher clarity and readability than procedural one, especially in complex code.
  • Clean and eloquent code is easier to review and independently reviewed code is more reliable and secure.
  • Code clarity largely influences the code's reusability for other purposes and by other people.
  • Consistency in a coding standard allows for cleaner and more comprehensible documentation.
  • Although it requires some tedious work, the usage of semantic checks on a massive scale pays off with more reliable code.
  • Adapting some of the familiar conventions that are used for method naming, parameter ordering, and method behavior from othe languages is better than making up new ones.
  • Unvarying return types with a fixed type for every method is better than varying return types when a value of one type can be mistaken for a value of another type.
  • Underscores