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
lista = ["primeiro", "segundo", "terceiro", 4] | |
println lista.size | |
lista += "quinto" | |
println lista.size | |
lista -= 4 | |
println lista.size | |
mapa = ["a" : 1, "b" : 2] |
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
lista = ["primeiro", "segundo", "terceiro", 4] | |
println lista.size | |
lista += "quinto" | |
println lista.size | |
lista -= 4 | |
println lista.size | |
lista << 7 |
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 Pessoa | |
{ | |
String nome | |
def methodMissing(String name, args) | |
{ | |
println "o método '${name}' não foi implementado." | |
} | |
} |
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
switch (seu valor) { | |
case 0..9 : //faz algo ; break | |
case [8,9,11] : //faz algo ; break | |
case Float : //faz algo ; break | |
case {it%3 == 0}: //faz algo ; break | |
case ~/../ : //faz algo ; break | |
default : //faz algo ; break | |
} |
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
if (this.Usuarios != null) | |
{ | |
Trace.WriteLine(DateTime.Now + " Sincronizando Usuarios..."); | |
foreach (var item in this.Usuarios) | |
{ | |
try | |
{ | |
DateTime data = DateTime.Parse("1/1/1753"); |
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
StringBuilder query = new StringBuilder(); | |
for(var i = 1;i<=10;i++) | |
for(var j = 1;j<=10;j++) | |
for(var x = 1;x<=135;x++) | |
query.AppendFormat("insert into tabela(...,...,...) values({0}, {1}, {2});", i, j, x) |
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 HomeController { | |
def foo = { | |
render text: "bar", contentType: "text/plain" | |
} | |
} |
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
#Primeiro problema do Project Euler http://projecteuler.net/ | |
#”Se nós listarmos todos os números naturais abaixo de 10, que são multiplos de 3 ou 5, nós obtemos 3,5,6 e 9. | |
#A soma destes múltiplos é 23. Encontre a soma de todos os múltiplos de 3 ou 5 abaixo de 1000.” | |
(1..1000).find_all{ |n| (n % 3).zero? || (n % 5).zero? }.inject{|sum,n| sum + n} |
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
def fatorial(n) | |
n.zero?? 1 : n * fatorial(n-1) | |
end |
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
(function(nome){ | |
console.log(nome) | |
})("Diego Dias"); |
OlderNewer