Skip to content

Instantly share code, notes, and snippets.

@davy
Last active September 11, 2015 06:09
Show Gist options
  • Save davy/60be06eb56b0e112d3ae to your computer and use it in GitHub Desktop.
Save davy/60be06eb56b0e112d3ae to your computer and use it in GitHub Desktop.
Ruby as Science, Art and Craft

Beautiful Code

Language Elements

# 49 methods for the price of one
# via @sferik
module Enumerable

# block & yield syntax
# via @_ZPH
def thing
  yield if block_given?
end

def thing_with_name name, &block
  block.yield(name)
end

# hash with default value block
# via @kevincbaird
Hash.new do |h,k|
  h[k] = functional_thing(k)
end

# #chomp
# via @sinthetix
"hello\r\n".chomp

Projects

Rake via @avdi

original dRuby via @m_seki

Minitest via @_ZPH

Sass via @jackyalcine

OAuth2 via @comaddox

Exercism.io via @geeksam

Capp via @drbrain

Axiom via @_m_b_j_

Learning

README & Doc

'I generally judge the quality of a codebase by the quality of its README and the inline documentation.' via @copiousfreetime

Programming with Nothing

Programming with Procs, (repo)

Programming without Alphanumerics, (repo)

both via @wobher

"Bob" Exercism Submission

Bob

via @geeksam

Fun

RubyHop Game

RubyHop

gem install rubyhop
rubyhop

via @blowmage

Implement enumerable methods using #inject instead of #each

gist.github.com/joshsusser/2646288

via @sferik

'Prettier' Ruby code*

gist.github.com/davidcelis/2831543

* for some definition of pretty ;)

via @davidcelis

BenString

It's Ben's special string

ben_string

via @bleything and @wobher

Perfect Code!!

perfect_code

via @1337807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment