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
irb(main):008:0> x = Enumerator.new(Float::INFINITY) { yield 1 } | |
=> #<Enumerator: #<Enumerator::Generator:0x007f85531b6360>:each> | |
irb(main):009:0> x.size | |
=> Infinity |
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
>> be vim | |
Your Ruby version is 2.2.3, but your Gemfile specified 2.1.7 | |
Vim: Caught deadly signal SEGV | |
Vim: Finished. | |
Segmentation fault: 11 |
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
# This is the default .slate file. | |
# If no ~/.slate file exists this is the file that will be used. | |
config defaultToCurrentScreen true | |
config nudgePercentOf screenSize | |
config resizePercentOf screenSize | |
config modalEscapeKey esc | |
alias modal esc,ctrl | |
alias mt ${modal}:toggle |
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
### In file version | |
klass = Class.new do | |
def hi | |
puts 'hello' | |
end | |
end | |
name = __FILE__.slice(/\w*.rb$/).slice(/\w*/).camelcase | |
Object.const_set(name, klass) |
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
=begin | |
This class allows you to condsolidate the declaration of class names into | |
the file name. It also handles namespacing based on the file path if you are | |
using Rails autoloading. | |
This works with the single exception of constant lookup via nesting, so you | |
will need to replace constants with variables and methods. | |
Examples: |
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
# app/models/user.rb | |
Dryer.def_class(__FILE__) do | |
def hi | |
"hello world" | |
end | |
end | |
User.new.hi | |
=> "hello world" |
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
highlight LongLines guibg=#333300 | |
au BufWinEnter * call matchadd('LongLines', '^.\{80,119}$', -1) | |
highlight VeryLongLines guibg=#330000 | |
au BufWinEnter * call matchadd('VeryLongLines', '^.\{120,}$', -1) | |
highlight Indent9 guibg=#645640 | |
au BufWinEnter * call matchadd('Indent9', '^\s\{20}\&^\s\{17}', -1) | |
highlight Indent8 guibg=#564832 |
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
module Animal | |
end | |
module Runner | |
refine Animal do | |
puts "I have #{legs} and I'm running!" | |
end | |
end | |
Dog.include Animal |
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
module Foo | |
def bar | |
"A cow" | |
end | |
end | |
describe Foo | |
let :subject_class { Class.new } | |
let :subject { subject_class.new } |
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
refinement Runner | |
def run | |
puts "I have legs and I am running" | |
end | |
end | |
object = Object.new | |
do |