This file contains 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
public static class Extensions { | |
public static int Megabytes(this int value) { | |
return value * 1024 * 1024; | |
} | |
public static int Kilobytes(this int value) { | |
return value * 1024; | |
} | |
public static int Days(this int value) { |
This file contains 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 MyTest | |
def factorial(n) | |
f = 1 | |
n.downto(2) { |x| f *= x } | |
f | |
end | |
inline do |builder| | |
builder.c " | |
long factorial_c(int max) { |
This file contains 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 ActiveRecord | |
class Errors | |
def add(attribute, msg = @@default_error_messages[:invalid]) | |
if replace_message?(msg) | |
msg = replace_message(attribute, msg) | |
attribute = :base | |
end | |
@errors[attribute.to_s] = [] if @errors[attribute.to_s].nil? | |
@errors[attribute.to_s] << msg |
This file contains 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
int *p[]; | |
1. Encontre o identificador. | |
int *p[]; | |
^ | |
"p é" | |
2. Siga pela direita enquanto encontrar um símbolo ou abre parênteses. |
This file contains 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
int i; "i um inteiro" | |
int *p; "p é um ponteiro para um inteiro" | |
int a[]; "a é um array de inteiros" | |
int f(); "f é uma função retornando um inteiro" | |
int **pp; "pp é um ponteiro para um ponteiro para um inteiro" | |
int (*pa)[]; "pa é um ponteiro para um array de inteiros" | |
int (*pf)(); "pf é um ponteiro para uma função retornando um inteiro" | |
int *ap[]; "ap é um array de ponteiros para inteiros" | |
int aa[][]; "aa é um array de arrays de inteiros" | |
int af[](); "af é um array de funções retornando um inteiro (ILEGAL)" |
This file contains 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
int *(*func())(); |
This file contains 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
int *p[]; | |
^^^ | |
"p é um array de ponteiros para int". | |
(ou "p é um array onde cada elemento é um ponteiro para um inteiro") |
This file contains 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
int *p[]; | |
^ | |
"p é um array de ponteiros para" |
This file contains 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
int *p[]; | |
^^ | |
"p é um array de" |
This file contains 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
int *p[]; | |
^ | |
"p é" |
NewerOlder