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 '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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
! special | |
*.foreground: #d2d4de | |
*.background: #161821 | |
*.cursorColor: #d2d4de | |
! black | |
*.color0: #161821 | |
*.color8: #6b7089 | |
! red |
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
#!/usr/bin/sudo sh | |
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+. | |
## From `strings ruby_concealer.so`: | |
## | |
## > This obfuscation is intended to discourage GitHub Enterprise customers | |
## > from making modifications to the VM. | |
## | |
## Well, good, as long as its not intended to discourage *me* from doing this! |
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 Item | |
def does_something(publishing_house = PublishingHouse.new) | |
publishing_house.publish(@document) | |
end | |
end | |
it 'publishes the document' do | |
publishing_house = stub('PublishingHouse') | |
publishing_house.should_receive(:publish).with(document) |
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
[47, 46, 45, ...].each do |i| | |
validates_numericality_of :"size_#{i}_quantity" | |
define_method :"size_#{i}_quantity" do | |
if self.variants.find_by_size(i) | |
self.variants.count_on_hand | |
else | |
0 | |
end | |
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
require 'spec_helper' | |
describe AController do | |
describe 'GET index' do | |
it 'returns the full list' do | |
Model.should_receive(:find).with(:all) | |
get :index | |
response.code.should eq ("200") |
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 upcase(text): | |
return text.upper() | |
@upcase | |
def words(text): | |
return ' '.join(text) | |
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 Animal | |
def initialize(legs) | |
@legs = legs | |
end | |
def legs_in_animal | |
@legs | |
end | |
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
def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil | |
nil.some_method_nil_doesnt_know_about | |
rescue Exception => ex | |
puts ex.class | |
end | |
test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil |
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 self.factory(plugin, &block) | |
candidates = self.plugin_paths.map do |path| | |
Dir["#{path}/#{plugin.to_s.downcase}.rb"][0] | |
end | |
candidate = candidates.detect(&:any?) | |
if candidate | |
require candidate | |
Plugin.const_get(plugin.to_s.capitalize.to_sym).new(&block) | |
else | |
raise YourSystem::PluginNotFound, "The #{plugin} plugin could not be loaded" |
NewerOlder