31
The small things Augusto Pascutti Monday, August 22, 2011

The small things

Embed Size (px)

Citation preview

Page 1: The small things

The small thingsAugusto Pascutti

Monday, August 22, 2011

Page 2: The small things

“Na teoria, teoria e prática são a mesma coisa. Na prática, não!

Yoggi Berra

Monday, August 22, 2011

Page 3: The small things

Existem 10 tipos de pessoas ...

Piada (infame) nerd

Monday, August 22, 2011

Page 4: The small things

1 <?php2 echo (int) ( (0.1+0.7) * 10 );3

Monday, August 22, 2011

Page 5: The small things

1 <?php2 echo (int) ( (0.1+0.7) * 10 );3 // Output: 7

Monday, August 22, 2011

Page 6: The small things

1 <?php2 $foo = 5 + "10 patos";3 var_dump($foo);4

Monday, August 22, 2011

Page 7: The small things

1 <?php2 $foo = 5 + "10 patos";3 var_dump($foo);4 // Output: int(15)

Monday, August 22, 2011

Page 8: The small things

1 <?php2 $foo = "5 galinhas" + "10 patos";3 var_dump($foo);4 // Output: int(15)

Monday, August 22, 2011

Page 9: The small things

1 <?php2 $foo = "5 galinhas" + 10;3 var_dump($foo);4 // Output: int(15)

Monday, August 22, 2011

Page 10: The small things

1 <?php2 $s = 'barra';3 $s[0] = 'f';4 echo $s;5 // output: farra

Monday, August 22, 2011

Page 11: The small things

1 <?php2 $a = 010;3 $b = 1;4 $x = $a + $b;5 var_dump($x);6

Monday, August 22, 2011

Page 12: The small things

1 <?php2 $a = 010;3 $b = 1;4 $x = $a + $b;5 var_dump($x);6 // Output: int(9)

Monday, August 22, 2011

Page 13: The small things

1 <?php2 $a = 010;3 $b = 1;4 $x = $a + $b;5 var_dump($a, $b);6 /**7 * Output:8 * int(8)9 * int(1)10 */

Monday, August 22, 2011

Page 14: The small things

1 <?php2 $a = array('1', '2');3 $a[] = 3;4 $a[0.1] = 4;5 print_r($a);6 // Array7 // (8 // [0] => 49 // [1] => 210 // [2] => 311 // )

Monday, August 22, 2011

Page 15: The small things

1 <?php2 $a = array('1', '2');3 $a[] = 3;4 $a[0.1] = 4;5 $a['0.1'] = 5;6 print_r($a);7 // Array8 // (9 // [0] => 410 // [1] => 211 // [2] => 312 // [0.1] => 513 // )

Monday, August 22, 2011

Page 16: The small things

1 <?php2 echo round(-0.4); // -03 echo round(-0.5); // -14 echo round(0.4); // 05 echo round(0.5); // 1

Monday, August 22, 2011

Page 17: The small things

1 <?php2 echo number_format(-0.4, 0); // -03 echo number_format(-0.5, 0); // -14 echo number_format(0.4, 0); // 05 echo number_format(0.5, 0); // 1

Monday, August 22, 2011

Page 18: The small things

1 <?php2 $s = "é";3 echo strlen($s);4

Monday, August 22, 2011

Page 19: The small things

1 <?php2 $s = "é";3 echo strlen($s);4 // Output: 2

Monday, August 22, 2011

Page 20: The small things

1 <?php2 echo HELLO;3 // Output HELLO

Monday, August 22, 2011

Page 21: The small things

1 <?php2 error_reporting(E_ALL & E_STRICT);

Monday, August 22, 2011

Page 22: The small things

1 $z = 'America/Sao_Paulo';2 date_default_timezone_set($z);

3 $s = date('c');4 // $s='2011-07-08T23:29:56-03:00'5 $t = strtotime($s);6 // $t=1310178596;

7 $d = strtotime('+8 HOUR', $t);8 // $d=1310207396;9 echo date('d/m/Y', $d);10 // Output: 09/07/2011

Monday, August 22, 2011

Page 23: The small things

1 <?php2 $s = 'Rails -> Fails';3 echo htmlentities($s);4 // Output: Rails -&gt; Fails

Monday, August 22, 2011

Page 24: The small things

1 <?php2 // PHP >= 5 3 $a = new StdClass();4 $a->name = 'Cleo';5 $b = $a;6 $b->name = 'Patra';7 echo $a->name;8 // Output: Patra

Monday, August 22, 2011

Page 25: The small things

1 <?php2 function up($o) {3 $n = strtoupper($o->name);4 $o->name = $n;5 }6 7 $a = new StdClass();8 $a->name = 'Cleo';9 up($a);10 echo $a->name;11 // Output: CLEO

Monday, August 22, 2011

Page 26: The small things

Eric Raymond

“Cursos de computação produzem bons programadores tanto quanto

estudar pincéis e pigmentação produzem bons pintores”

Monday, August 22, 2011

Page 27: The small things

Leia(Tire suas próprias conclusões)

Monday, August 22, 2011

Page 28: The small things

Pratique(Open Source)

Monday, August 22, 2011

Page 29: The small things

“Você nunca vai saber que um programador está fazendo merda

até ser tarde demais.”

Seymour Cray

Monday, August 22, 2011

Page 30: The small things

Métodos ágeis(Entregue pouco, muitas vezes)

Monday, August 22, 2011

Page 31: The small things

Dúvidas?

Slides, comentários e brinders: http://joind.in/3650Monday, August 22, 2011