Also https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.1.
(fibonacci 10)| def self.debug(indent, label, context: nil, stack: nil) | |
| body = if context && stack | |
| [ | |
| "#{indent * 2} context", | |
| *context_chain(indent * 4, context), | |
| "#{indent * 2} stack", | |
| *call_stack(indent * 4, stack) | |
| ] | |
| elsif context | |
| [ |
| URL = class { | |
| @.initialize = => { | |
| -> (scheme, user, password, host, port, path, query, fragment) { | |
| @.scheme = scheme | |
| @.user = user | |
| @.password = password | |
| @.host = host | |
| @.port = port | |
| @.path = path | |
| @.query = query |
| /** | |
| * HSL clock | |
| */ | |
| height: 100%; | |
| font: bold 5em/1 Helvetica Neue, sans-serif; | |
| display: flex; | |
| text-align: center; | |
| align-items: center; | |
| justify-content: center; |
| [1] module > foo = -> (a, b, c) { a + b + c } | |
| => { | |
| -> (a<#< System.Object >>, b<#< System.Object >>, c<#< System.Object >>) { ... } | |
| } | |
| [2] module > foo4 = foo(4) | |
| => { | |
| -> (b<#< System.Object >>, c<#< System.Object >>) { ... } | |
| } |
| test = System.require('test') | |
| test.group('group name', -> (t) { | |
| t.test('test name', -> (t) { | |
| t.expect(1 + 1) toEqual 2 | |
| }) | |
| t.test('failing test', -> (t) { | |
| t.expect(1 + 1) toEqual 1 | |
| }) |
| var Hapi = require('hapi'); | |
| var server = new Hapi.Server('localhost', 5000); | |
| server.route({ | |
| method: 'GET', | |
| path: '/', | |
| handler: function (request, reply) { | |
| reply('hello world'); | |
| } |
| ## config/initializers/conf_conf.rb | |
| # load user-specific environment files | |
| # (env* should be added to .gitignore) | |
| [ | |
| Rails.root + "env_#{Rails.env}.rb", | |
| Rails.root + 'env.rb' | |
| ].each do |env_file| | |
| require env_file if env_file.file? | |
| end |
| class FunctionalArray | |
| attr_reader :head | |
| attr_reader :tail | |
| def initialize(*items) | |
| @head = items.first | |
| tail = items[1..-1] | |
| @tail = (tail.count > 0) ? self.class.new(items[1..-1]) : [] | |
| end | |