Skip to content

Instantly share code, notes, and snippets.

View aleandros's full-sized avatar
💻
Building!

Edgar Cabrera aleandros

💻
Building!
View GitHub Profile
action = :to_s.to_proc
action.call(1) #=> "1"
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
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
def not_much
yield
end
not_much do # Call m setting its associated block
puts 'No surprises'
end
#=> It prints, unsurprisingly
# No surprises
x = [1, 2, 3, 4]
x.map { |n| n.to_s }.join('-') #=> "1-2-3-4"
x = [1, 2, 3, 4]
x.map(&:to_s).join('-') #=> "1-2-3-4"
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'"
-- 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
# 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