Skip to content

Instantly share code, notes, and snippets.

class Elevator
def initialize(floor)
@floor = floor
end
attr_accessor :floor
def greet
for i in 0..floor
if i == 0
puts "Basement."
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sierpinski triangle</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">
//Width and height
@jraines
jraines / as_dependencies_patch.rb
Created May 11, 2011 20:54 — forked from cowboycoded/as_dependencies_patch.rb
patch ActiveSupport::Dependencies to allow loading of same-name models, controllers, etc. from base Rails app and attached engines
#This goes in application.rb
require 'active_support/dependencies'
module ActiveSupport::Dependencies
alias_method :require_or_load_without_multiple, :require_or_load
def require_or_load(file_name, const_path = nil)
if file_name.starts_with?(Rails.root.to_s + '/app')
relative_name = file_name.gsub(Rails.root.to_s, '')
@engine_paths ||= Rails::Application::Railties.engines.collect{|engine| engine.config.root.to_s }
@engine_paths.each do |path|