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
%ul= list_of(@product.product_sizes) do |size| | |
%li= size |
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'rubygems' | |
require 'markaby' | |
require 'tagz' | |
require 'builder' | |
max = (ARGV.shift || 1_000_000).to_i |
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
# Version 1 | |
case foo | |
when bar | |
baz | |
end | |
# Version 2 | |
case foo | |
when bar | |
baz |
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
(defun haml-mumamo-chunk (pos min max) | |
(mumamo-find-possible-chunk pos min max | |
'haml-mumamo-bw-exc-start-fun | |
'haml-mumamo-bw-exc-end-fun | |
'haml-mumamo-fw-exc-start-fun | |
'haml-mumamo-fw-exc-end-fun)) | |
(defun* haml-mumamo-exc-start-fun (pos lim max dir) | |
(if (or (null lim) (null max) (null pos)) (return)) | |
(flet ((check-lim () (when (> (point) max) (return)))) |
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 self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def foo | |
puts "Foo!" | |
end | |
end |
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
-# Three possibilities: | |
%a{:href => "#"}> foo | |
: bar | |
= succeed ':' do | |
%a{:href => "#"} foo | |
bar | |
<a href="#">foo</a>: bar |
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
(let ((foo "ruby-mode")) | |
(string-match "\\([[:alpha:]-]+\\)\\-mode" foo) | |
(match-string 1 foo)) | |
"ruby" |
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
class CourseController < ApplicationController | |
def new | |
@course = Course.new | |
end | |
def input | |
@course = Course.new(params[:course]) | |
if @course.save | |
redirect_to '/' |
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
class Foo | |
def foo | |
end | |
end | |
class Bar < Foo | |
end | |
if $0 == __FILE__ | |
YARD.parse(__FILE__) |
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
class Foo | |
def self.foo | |
end | |
end | |
if $0 == __FILE__ | |
YARD.parse(__FILE__) | |
# Correct | |
p YARD::Registry.resolve(:root, "Foo.foo", true) #=> Foo.foo |