This file contains hidden or 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 AModule | |
class String | |
def i_like_open_classes | |
puts "#{self} hasn't been monkey patched" | |
end | |
end | |
end | |
string = String.new | |
begin |
This file contains hidden or 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 ModuleExample | |
def self.hello_world | |
puts 'This is a static hello world from a module' | |
end | |
def hello_world | |
puts 'This is a non static hello world from a module' | |
end | |
end |
This file contains hidden or 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 ComputerBrand | |
include Comparable | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def <=>(other) |
This file contains hidden or 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 AccessControlExamples | |
def public_method_by_default | |
end | |
protected | |
def first_protected_method | |
end | |
def second_protected_method | |
end | |
This file contains hidden or 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 MoreAccessControlExamples | |
def public_by_default | |
end | |
protected def protected_method | |
end | |
public def this_is_public_too | |
end | |
This file contains hidden or 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 EvenMoreAccessControlExamples | |
def public_by_default | |
end | |
def protected_method | |
end | |
def this_is_public_too | |
end | |
This file contains hidden or 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
"Disable arrows | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> | |
imap <right> <nop> |
This file contains hidden or 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
Post explaining how the blog file format works. | |
#title: | |
The post file format | |
#description: | |
Showing the file format that the blog posts have in my blog engine | |
#date: | |
2011-03-22 22:00 |
This file contains hidden or 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
!!! XML | |
%rss(version="2.0" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:atom="http://www.w3.org/2005/Atom") | |
%channel | |
%title Javier Acero's blog | |
%link #{url('blog/rss')} | |
%atom:link(href="#{url('blog/rss')}" | |
rel="self" |
This file contains hidden or 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
set_name = (name) -> @name = name | |
set_name 'Juan' | |
console.log name #Juan | |
console.log @name #undefined | |
#How context works here is pretty weird... | |
#Looks like set_name is not evaluated on "this" context | |
#This seems quite true if we do: |