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
Imovel.find({}).remove(function() { | |
Imovel.create({ | |
name : 'Fazenda xoxa', | |
info : 'Fazenda em xoxa' | |
}, function(err, imovel){ | |
Imovel.create({ | |
name : 'Fazenda carapebus', | |
info : 'Fazenda em carapebus', | |
relacao: imovel | |
}) |
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 factorial | |
factorial = { it > 1 ? it * factorial(it-1) : it } | |
factorial(1) // 1 | |
factorial(2) // 2 | |
factorial(3) // 6 | |
factorial(4) // 24 | |
factorial(5) // 120 |
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 factorial(n) | |
n>1 ? n * factorial(n-1) : n | |
end | |
puts factorial(1) # 1 | |
puts factorial(2) # 2 | |
puts factorial(3) # 6 | |
puts factorial(4) # 24 | |
puts factorial(5) # 120 |
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
var factorial = function factorial_i(n) { | |
return (n > 1) ? n * factorial_i(n-1) : n; | |
}; | |
console.log(factorial(1)); //1 | |
console.log(factorial(2)); //2 | |
console.log(factorial(3)); //6 | |
console.log(factorial(4)); //24 | |
console.log(factorial(5)); //120 |
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
Files.lines(Paths.get("/myfile.txt")).forEach(System.out::println); |
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
import feign.Feign; | |
import feign.Param; | |
import feign.RequestLine; | |
import feign.gson.GsonDecoder; | |
import java.util.List; | |
class FeignLibrary { | |
static class Contributor { |
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
import com.sun.jersey.api.client.Client; | |
import com.sun.jersey.api.client.ClientResponse; | |
import com.sun.jersey.api.client.WebResource; | |
import com.sun.jersey.api.client.config.ClientConfig; | |
import com.sun.jersey.api.client.config.DefaultClientConfig; | |
import com.sun.jersey.api.json.JSONConfiguration; | |
import org.codehaus.jackson.annotate.JsonCreator; | |
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | |
import org.codehaus.jackson.annotate.JsonProperty; |
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
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpGet; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClientBuilder; | |
import org.json.JSONArray; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; |
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
const https = require('https'); | |
const opts = { | |
protocol: 'https:', | |
host: 'api.github.com', | |
path: '/repos/twilio/twilio-node/contributors', | |
headers: {'user-agent': 'My App'} | |
}; | |
https.get(opts, (res) => { |
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
// install the dependency > npm install request | |
const request = require('request'); | |
const opts = { | |
uri: 'https://api.github.com/repos/twilio/twilio-node/contributors', | |
headers: {'user-agent': 'My App'} | |
}; | |
request(opts, (error, response, body) => { |
OlderNewer