- GitHub Staff
- danieljamescolson.com
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
| begin | |
| require "bundler/inline" | |
| rescue LoadError => e | |
| $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
| raise e | |
| end | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| gem "rails" |
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
| RUBY_VERSION='2.1.10' | |
| # Fails with 2.0.0 and 2.1.10 | |
| # Passes with 2.3.1 and 2.4.1 | |
| # Have not tried with any other versions | |
| begin | |
| require "bundler/inline" | |
| rescue LoadError => e | |
| $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
| raise e |
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
| require 'benchmark' | |
| def yielder | |
| yield | |
| end | |
| def caller(&block) | |
| block.call | |
| end |
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
| # frozen_string_literal: true | |
| require "bundler/inline" | |
| gemfile(true) do | |
| source "https://rubygems.org" | |
| git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
| gem "rails", path: "/Users/composerinteralia/code/rails/rails" |
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
| class SeedQueue | |
| def self.<<(seed) | |
| seed.plant | |
| end | |
| end | |
| class Seed | |
| include ActiveModel::Attributes | |
| end | |
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
| # Quines are programs that print their own source code | |
| # This program is a quine that explains how some Ruby quines work | |
| # This first one uses a heredoc with 2 as the delimiter | |
| # The beginning of the program appears twice (before and inside the heredoc) | |
| # Then it puts the string twice (* 2) and puts 2 | |
| puts <<2*2,2 | |
| # Quines are programs that print their own source code | |
| # This program is a quine that explains how some Ruby quines work |
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
| -> ( # | |
| _ , | |
| & __ | |
| ){ t= | |
| -> { ; | |
| __[ [ | |
| _1], _[2 | |
| ], _[ | |
| 1] ]} | |
| _=__[ _[3 .. |
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
| def type(obj) | |
| case obj.object_id | |
| when 0 | |
| :false | |
| when 8 | |
| :nil | |
| when 20 | |
| :true | |
| when -> { _1[0] == 1 } | |
| :integer |