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
FROM ruby:3.0.2-alpine3.14 | |
ARG UID | |
ARG GID | |
ARG BUNDLE_PATH="vendor/bundle" | |
ARG BUNDLE_DEPLOYMENT=true | |
ARG BUNDLE_WITHOUT="test development" | |
ENV BUNDLE_PATH $BUNDLE_PATH | |
ENV BUNDLE_DEPLOYMENT $BUNDLE_DEPLOYMENT | |
ENV BUNDLE_WITHOUT $BUNDLE_WITHOUT |
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
# frozen_string_literal: true | |
module Api | |
module V1 | |
# Controller to consume read-only data to be used on client's frontend | |
class FrontEndController < ActionController::API | |
prepend_before_action :set_root_resource | |
before_action :set_object, except: %i[index schema] | |
append_before_action :set_nested_resource, only: %i[nested_index] | |
append_before_action :set_records, only: %i[index nested_index] |
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
defmodule FlattenTest do | |
use ExUnit.Case | |
doctest Flatten | |
test "flats an empty array" do | |
assert Flatten.flat([]) == [] | |
end | |
test "flats an array with just one element" do | |
assert Flatten.flat([1]) == [1] |
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
defmodule Flatten do | |
def flat(list=[]) do | |
list | |
end | |
def flat([head|tail]) when is_list(head) do | |
flat(head) ++ flat(tail) | |
end | |
def flat([head|tail]) do |
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 cannonRotation = 5; | |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
robot.turn(360 - robot.angle); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(10); |