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
/// Computes the greatest common divisor (GCD) of two integers using the Euclidean algorithm. | |
/// - Parameters: | |
/// - a: An integer value. | |
/// - b: Another integer value. | |
/// - Returns: The greatest common divisor of `a` and `b`. | |
func gcd(_ a: Int, _ b: Int) -> Int { | |
b == 0 ? a : gcd(b, a % b) | |
} | |
// Example usage |
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
[ | |
{ | |
"title": "Brain\u2013machine interfaces: past, present and future", | |
"year": "2006", | |
"link": "https://scholar.google.com/citations?view_op=view_citation&hl=en&user=RefX_60AAAAJ&pagesize=100&citation_for_view=RefX_60AAAAJ:9yKSN-GCB0IC", | |
"citations": "2356" | |
}, | |
{ | |
"title": "Learning to control a brain\u2013machine interface for reaching and grasping by primates", | |
"year": "2003", |
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
[ | |
{ | |
"title": "Dependency Management in iOS Development: A Developer Survey Perspective", | |
"year": "2024", | |
"link": "https://scholar.google.com/citations?view_op=view_citation&hl=en&user=6nOPl94AAAAJ&pagesize=100&sortby=pubdate&citation_for_view=6nOPl94AAAAJ:hqOjcs7Dif8C", | |
"citations": "0" | |
}, | |
{ | |
"title": "Apple Vision Pro: Comments in Healthcare", | |
"year": "2024", |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = (params['page'] || 0).to_i | |
MAX_ATTEMPTS = 10 | |
attempts = 0 | |
doc = nil |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = (params['page'] || 0).to_i | |
url = "https://www.elcorteingles.pt/supermercado/pesquisar/" + (page > 0 ? "#{page}" : "") + "?term=#{query}&search=text" | |
document = Nokogiri::HTML(open(url, read_timeout: 30)) |
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
require 'net/http' | |
require 'json' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = (params['page'] || 0).to_i | |
from = page * 100 | |
uri = URI('https://mercadao.pt/api/catalogues/6107d28d72939a003ff6bf51/products/search') | |
uri.query = URI.encode_www_form({ |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = (params['page'] || 0).to_i | |
url = "https://www.auchan.pt/pt/pesquisa?q=#{query}&search-button=&lang=pt_PT&start=#{page * 24}&sz=24" | |
document = Nokogiri::HTML(open(url)) | |
search_items = document.css('div.auc-product').map do |tile| |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = (params['page'] || 0).to_i | |
url = "https://lojaonline.intermarche.pt/26-famoes/produit/recherche?mot=#{query}" | |
document = Nokogiri::HTML(open(url)) | |
search_items = document.css('ul.vignettes_produit > li.vignette_produit_info').map do |tile| |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = params['page'].to_i || 0 | |
url = "https://www.continente.pt/pesquisa/?q=#{query}&start=#{page * 36}&srule=Continente%2003&pmin=0.01" | |
document = Nokogiri::HTML(open(url)) | |
search_items = document.css('div.productTile').map do |tile| |
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
require 'nokogiri' | |
require 'open-uri' | |
Encoding.default_external = 'UTF-8' | |
query = params['query'] || 'banana' | |
page = params['page'].to_i || 0 | |
url = "https://www.celeiro.pt/catalogsearch/result/?q=#{query}" | |
document = Nokogiri::HTML(open(url)) | |
search_items = document.css('ol.product-items > li.item').map do |tile| |
NewerOlder