Skip to content

Instantly share code, notes, and snippets.

View nex3's full-sized avatar

Natalie Weizenbaum nex3

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