2011-08-04

Ruby true or false

The test

def true?(x)
    if x
        return "true"
    else
        return "false"
    end
end

tests = [false,true,0,1,nil,[],{},"","0","1","true","false"]

tests.each do |test|
    puts test.inspect+":\t "+true?(test)+" ("+test.class.to_s+")"
end

The results

false:   false (FalseClass)
true:    true (TrueClass)
0:       true (Fixnum)
1:       true (Fixnum)
nil:     false (NilClass)
[]:      true (Array)
{}:      true (Hash)
"":      true (String)
"0":     true (String)
"1":     true (String)
"true":  true (String)
"false":         true (String)

For later reference.

2011-08-02

Álmaid nője 1 perce halott / The woman of your dreams died a minute ago

English version follows


A mindenki.hu egy olyan szájt, ahol az emberek feltehetnek és megválaszolhatnak személyes preferenciákra vonatkozó kérdéseket, majd aztán megkereshetik hogy ki mennyire hasonlít hozzájuk vagy különbözik tőlük.

Volt ott egy kérdés: Lefeküdnél álmaid nőjével, úgy hogy már 1 perce halott?

  • A: persze, ha adódik egy alkalom, akkor nem szabad kihagyni.
  • B: ez undorító!!
  • C: lány vagyok
  • D: attól függ, hogyan halt meg

Az eredmények:

  • A: 2%
  • B: 52%
  • C: 33%
  • D: 11%

Ha ezek küzül az eredmények közül megnézzük a férfiakra vonatkozó részt:

  • A: 3%
  • D: 17%

Azaz a férfiak 20%-a [te mondod meg].


English version

The mindenki.hu is a site where people can raise and answer questions about personal preferences and then they can see who is similar and who is different to them.

There was a question: Would you "sleep" with the woman of your dreams if she were dead for 1 minute?

  • A: Of course. If an opportunity raises, it should not be missed.
  • B: This is disgusting.
  • C: I am a woman.
  • D: It depends on the way she died.

The results:

  • A: 2%
  • B: 52%
  • C: 33%
  • D: 11%

Taking the shocking results only on men:

  • A: 3%
  • D: 17%

So 20% of men are [you name it].