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
action = :to_s.to_proc | |
action.call(1) #=> "1" |
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
obj = Object.new | |
# We create a method ONLY for obj | |
class << obj | |
def to_proc | |
proc { puts 'This looks like fun' } | |
end | |
end | |
not_much &obj | |
#=> It prints |
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
def not_much(&action) # Convert method's block into a proc | |
action.call | |
end | |
action = proc { puts 'hi' } | |
not_much &action # Convert proc into method's block | |
#=> It prints | |
# hi |
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
def not_much | |
yield | |
end | |
not_much do # Call m setting its associated block | |
puts 'No surprises' | |
end | |
#=> It prints, unsurprisingly | |
# No surprises |
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
x = [1, 2, 3, 4] | |
x.map { |n| n.to_s }.join('-') #=> "1-2-3-4" |
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
x.map(&:to_s) |
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
x = [1, 2, 3, 4] | |
x.map(&:to_s).join('-') #=> "1-2-3-4" |
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 ApplicationHelper | |
# Top menu for helper for zurb foundation in RefineryCMS | |
def zurb_menu | |
menu_items = Refinery::Menu.new(Refinery::Page.in_menu) | |
presenter = Refinery::Pages::MenuPresenter.new(menu_items, self) | |
presenter.css = "top-bar-section" | |
presenter.dom_id = nil | |
presenter.menu_tag = :section | |
presenter.list_tag = "ul class='left'" |
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
-- Configuration file used in xmonad for ubuntu 13.04 | |
-- Changes monMask tu super (windows) key. | |
-- Better support for fullscreen apps (falsh videos, totem, chrome, etc.) | |
-- And some other small changes. Enjoy. | |
import XMonad | |
import XMonad.Config.Gnome | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Layout.Fullscreen | |
import XMonad.Layout.NoBorders | |
import XMonad.Hooks.ICCCMFocus |
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
# status bar colors etc | |
set-option -g status-bg black | |
set-option -g status-fg blue | |
set-option -g status-interval 5 | |
set-option -g visual-activity on | |
set-window-option -g monitor-activity on | |
set-window-option -g window-status-current-fg white | |
# command prefix | |
set -g prefix C-a |
NewerOlder