Skip to content

Instantly share code, notes, and snippets.

View theleoborges's full-sized avatar

Leonardo Borges theleoborges

View GitHub Profile
@theleoborges
theleoborges / gist:790886
Created January 22, 2011 05:22
learning-objective-c-a-ruby-analogy#4
[myArray each: ^(id *item){
NSLog(@"Current item: %@", item);
}];
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:23
hacking-rubys-syntax#0
# this is the first way to do it
class Test
def say_hello
puts "I'm a private method"
end
private :say_hello
end
# and this is the second way
class Test
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:24
hacking-rubys-syntax#1
class Test
def method_a
method_b
end
def method_b
puts "I'm a private method"
end
private :method_b
end
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:26
hacking-rubys-syntax#2
class Test
def method_a
method_b
end
#just another public method. We might have several
def method_c
method_b
end
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:27
hacking-rubys-syntax#3
class Test
def_p say_hello
puts "I'm a private method"
end
end
@theleoborges
theleoborges / gist:791031
Created January 22, 2011 10:28
hacking-rubys-syntax#4
$ ./configure
$ make
@theleoborges
theleoborges / test.rb
Created January 22, 2011 10:32
hacking-rubys-syntax#5
class Test
def_p say_hello
puts "I'm a private method"
end
end
Test.new.say_hello
@theleoborges
theleoborges / gist:791034
Created January 22, 2011 10:33
hacking-rubys-syntax#5
pvt.rb:10:in `': private method `say_hello' called for # (NoMethodError)
#ruby
> a = [0]
> i = 0; for i in 0...(a.size) do; puts "in the loop"; end
> puts i
Produces:
# in the loop
# 0
@theleoborges
theleoborges / gist:913382
Created April 11, 2011 11:29
Ruby 1.9 SSL
The fix for this..
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Seems to be setting this config:
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
The question though is, why it fixes it? Is it actually the right way to fix it?