<?php
require 'vendor/autoload.php';
$app = new \Slim\App();
// Executed last as it's first in (FILE)
$app->add(function ($request, $response, $next) {
// Execute the routes first
One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.
Let's take the example of simulating the rolling of a die.
We can represent a die as an array of its faces.
die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
This file contains hidden or 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 domain = require("domain"); | |
var d = domain.create(); | |
d.on("error", function() { | |
console.log("domain caught"); | |
}); | |
try { | |
d.run(function() { | |
process.nextTick(function() { |
This file contains hidden or 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
COLOR_ESCAPES = { | |
:none => 0, | |
:bright => 1, | |
:black => 30, | |
:red => 31, | |
:green => 32, | |
:yellow => 33, | |
:blue => 34, | |
:magenta => 35, | |
:cyan => 36, |
NewerOlder