Skip to content

Instantly share code, notes, and snippets.

View ezefranca's full-sized avatar
💻
👨🏻‍💻

Ezequiel Santos ezefranca

💻
👨🏻‍💻
View GitHub Profile
@ezefranca
ezefranca / gcd_euclidean.swift
Created July 26, 2024 11:18
A Swift function to compute the greatest common divisor (GCD) of two integers using the Euclidean algorithm.
/// 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
[
{
"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",
[
{
"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",
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
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))
@ezefranca
ezefranca / pingodoce.rb
Created March 13, 2023 19:25
Quem trouxe, quem trouxe.
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({
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|
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|
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|
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|