Skip to content

Instantly share code, notes, and snippets.

View hcarreras's full-sized avatar

Hari Abtion hcarreras

  • Abtion
  • Copenhagen
View GitHub Profile
@hcarreras
hcarreras / scrape.rb
Created June 5, 2023 13:10
Scrape data
require 'capybara'
require 'selenium-webdriver'
# List of URLs to be iterated
urls = [
'https://example.com/kontakt/om-os/miljoe-csr',
'https://example.com/kontakt/om-os',
]
# Capybara setup
# Use TDD principles to build out name functionality for a Person.
# Here are the requirements:
# - Add a method to return the full name as a string. A full name includes
# first, middle, and last name. If the middle name is missing, there shouldn't
# have extra spaces.
# - Add a method to return a full name with a middle initial. If the middle name
# is missing, there shouldn't be extra spaces or a period.
# - Add a method to return all initials. If the middle name is missing, the
# initials should only have two characters.
#
const newArr = array1.reduce((sum, curr, idx) => {
const existsAt = array2.findIndex(orgItem => orgItem.id === curr.id)
if (existsAt !== -1) {
return [...sum.splice(0, idx), array2[existsAt], ...sum.splice(idx + 1)]
}
return [...sum, curr]
}, [])
Parameters: {"\"{\\\"request_data\\\":\\\""=>{"{referencia: 1, ultima_modificacion: '26/01/2015'}"=>{"\\\"}\""=>nil}}}
curl -X POST -H "Content-Type: application/json" -d "{\"request_data\":\"[{referencia: 1, ultima_modificacion: '26/01/2015'}]\"}" http://aga-osl.herokuapp.com/stock/search.json
- (id)initAnimal: (Clue *) letra : (Clue *) sonido : (Clue *) tiene_esqueleto;
{
_sonido = sonido;
_tiene_esqueleto = tiene_esqueleto
_come = [[Clue alloc] initTodo: @"come" : @"si" : @"come."];
_respira = [[Clue alloc] initTodo: @"respira" : @"si" : @"respira."];
_se_reproduce = [[Clue alloc] initTodo: @"se reproduce" : @"si" : @"se reproduce."];
_tiene_sangre = [[Clue alloc] initTodo: @"tiene sangre" : @"si" : @"tiene sangre."];
_se_mueve = [[Clue alloc] initTodo: @"se mueve" : @"si" : @"se mueve."];
_tiene_celulas = [[Clue alloc] initTodo: @"tiene celulas" : @"si" : @"esta formado por celulas."];
//
// Level1.m
// VeoVeo
//
// Created by Alberto Quesada Aranda on 23/11/13.
// Copyright (c) 2013 VV Company. All rights reserved.
//
#import "Level1.h"
#import "Level2.h"
+(NSMutableString *) compara : (NSString *) name1 : (NSMutableArray *) asked_clues1 : (NSString *) name2 : (NSMutableArray *) clues2
{
NSMutableString *respuesta;
Clue *clueA, *clueB, *some_clue;
bool mismo_attr = false;
for (clueA in asked_clues1){
for(clueB in clues2){
if(clueA.attr == clueB.attr){
if(clueA.value != clueB.value){
+(NSMutableString *) compara : (NSString *) name1 : (NSMutableArray *) asked_clues1 : (NSString *) name2 : (NSMutableArray *) clues2
{
NSMutableString *respuesta;
Clue *clueA, *clueB;
for (clueA in asked_clues1){
for(clueB in clues2){
if(clueA.attr == clueB.attr){
if(clueA.value != clueB.value){
respuesta = [[NSMutableString alloc] initWithString:name2];
#import "Nature.h"
@implementation Nature
-(id)init
{
self = [super init];
return self;
}