Skip to content

Instantly share code, notes, and snippets.

@dimgrav dimgrav/Candidate.md

Last active Sep 7, 2017
Embed
What would you like to do?
Spidergap Software Developer application: answers to the coding questions
/*
Application to Spidergap for the role of Software Developer
Question 1: deepClone (create a copy of a given object)
Dimitrios Gravanis, 2017 -- <dimgrav@gmail.com>
*/
/* deep clone object of the example types and return a copy */
function deepClone(obj) {
var objCopy = {};
// use standard ES5
try {
objCopy = JSON.parse(JSON.stringify(obj));
}
catch(err) {
alert(err.name + " " + err.message);
}
return objCopy;
}
/* test object according to example */
var TestObject = {
personalDetails: {name: 'Dimitrios', surname: 'Gravanis', age: 29},
job: 'Software Engineer',
location: {country: 'Greece', city: 'Larisa'}
};
console.log(deepClone(TestObject));
/*
Application to Spidergap for the role of Software Developer
Question 2: Locate partners within 100km from Central London
Dimitrios Gravanis, 2017 -- <dimgrav@gmail.com>
*/
/* import partner information from the supplied JSON file */
var partners = require('./partners.json');
/* extract all office locations */
var officeLocations = {};
for (var i = 0; i < partners.length; i++) {
officeLocations[i] = JSON.parse(JSON.stringify(partners[i].offices));
}
// GET PARTNER COORDINATES FROM JSON
function findCoordinates() {
var strings = [];
var coordinates = [];
var partnerOffices = 0;
for (var i = 0; i < partners.length; i++) {
partnerOffices = officeLocations[i].length;
if (!strings[i] || !coordinates[i]) {
strings[i] = [];
coordinates[i] = [];
}
for (var j = 0; j < partnerOffices; j++) {
strings[i][j] = officeLocations[i][j].coordinates.split(",");
coordinates[i][j] = strings[i][j].map(Number);
}
}
return coordinates;
}
// CONVERT DEGREES TO RADIANS
function toRadians(angle) {
return angle * (Math.PI / 180);
}
// CALCULATE DISTANCES TO PARTNERS
function calculateDistances(coor) {
var coorLondon = [51.515419, -0.141099];
var coor = findCoordinates();
var dfi = [];
var dlambda = [];
var dsigma = [];
var distances = [];
for (var i = 0; i < coor.length; i++) {
dfi[i] = [];
dlambda[i] = [];
dsigma[i] = [];
distances[i] = [];
for (var j = 0; j < coor[i].length; j++) {
dfi[i][j] = (toRadians(coorLondon[0]) - toRadians(coor[i][j][0]));
dlambda[i][j] = (toRadians(coorLondon[1]) - toRadians(coor[i][j][1]));
dsigma[i][j] = Math.acos(Math.cos(dfi[i][j]) * Math.cos(dlambda[i][j]));
distances[i][j] = 6371 * dsigma[i][j];
}
}
return distances;
}
// FIND PARTNERS WITHIN RANGE OF 100KM
function findPartners(dist) {
var dist = calculateDistances(findCoordinates());
var partnersArray = [];
var partnersInRange;
for (var i = 0; i < dist.length; i++) {
for (var j = 0; j < dist[i].length; j++) {
if (dist[i][j] <= 100) {
partnersArray.push(partners[i]["organization"] + ", " +
officeLocations[i][j]["address"]);
}
}
}
partnersArray.sort();
partnersInRange = partnersArray.join("\r\n");
return partnersInRange;
}
/* test log to console */
console.log(findPartners());
[
{
"id": 1,
"urlName": "balance-at-work",
"organization": "Balance at Work",
"customerLocations": "across Australia, Pacific and Oceania",
"willWorkRemotely": true,
"website": "http://www.balanceatwork.com.au/",
"services": "At Balance at Work, we want to help you make work a joy for your employees and you! We specialize in leadership development, talent management and career coaching, and use Spidergap as one of our tools to help employees focus their development and achieve more.",
"offices": [
{
"location": "Sydney, Australia",
"address": "Suite 1308, 109 Pitt St \nSydney 2000",
"coordinates": "-33.8934219,151.20404600000006"
}
]
},
{
"id": 2,
"urlName": "spring-development",
"organization": "Spring Development",
"customerLocations": "across the UK",
"willWorkRemotely": true,
"website": "http://www.springdevelopment.net/",
"services": "We provide training, coaching and consultancy to ensure that 360 feedback is delivered positively and constructively, maximising personal development. We can train your people to carry out effective feedback meetings or, if you would benefit from having external, impartial facilitators, we can come and do them for you. We're always happy to have an initial confidential discussion to explore how we can help you.",
"offices": [
{
"location": "Banbury, Oxfordshire",
"address": "Banbury, Oxfordshire",
"coordinates": "52.0629009,-1.3397750000000315"
}
]
},
{
"id": 3,
"urlName": "talent-lab",
"organization": "Talent Lab",
"customerLocations": "across Latin America",
"willWorkRemotely": true,
"website": "http://www.talentlab.mx/",
"services": "We are passionate about people and the capability we all have to evolve and make great things together. We free company's potential through their people through innovative tools, holistic solutions and tailored Human Resources Strategies.",
"offices": [
{
"location": "México City, Mexico",
"address": "Emerson 150 - 503, Colonia Chapultepec Morales, Delegación Miguel Hidalgo, México City, Mexico, CP 11570",
"coordinates": "19.4361004,-99.18870959999998"
}
]
},
{
"id": 4,
"urlName": "blue-square-360",
"organization": "Blue Square 360",
"customerLocations": "globally",
"willWorkRemotely": true,
"website": "http://www.bluesquare360.com/",
"services": "Blue Square 360 provides a professionally managed service covering all areas of a 360° Feedback initiative. We're experienced in supporting projects of all sizes, and always deliver a personal service that provides the level of support you need to ensure your 360 initiative delivers results for the business.",
"offices": [
{
"location": "Singapore",
"address": "Ocean Financial Centre, Level 40, 10 Collyer Quay, Singapore, 049315",
"coordinates": "1.28304,103.85199319999992"
},
{
"location": "London, UK",
"address": "St Saviours Wharf, London SE1 2BE",
"coordinates": "51.5014767,-0.0713608999999451"
}
]
},
{
"id": 5,
"urlName": "raiser",
"organization": "Raiser Resource Group",
"customerLocations": "across Africa",
"willWorkRemotely": true,
"website": "http://www.raiser.co.ke/",
"services": "Raiser Resource Group is a Kenya based company specializing in human performance improvement in Africa. We help individuals and organizations achieve sustainable results that require a change in human behavior and use Spidergap to assess our clients' competency skills.",
"offices": [
{
"location": "Nairobi, Kenya",
"address": "Jumuia Place, Off Lenana Road, Nairobi, Kenya",
"coordinates": "-1.2890117,36.793729600000006"
}
]
},
{
"id": 6,
"urlName": "inspire-ignite",
"organization": "Inspire - Ignite",
"customerLocations": "across the UK",
"willWorkRemotely": true,
"website": "http://www.inspireignite.net/",
"services": "'Inspire - Ignite' is built on the philosophy that people perform better when they can be themselves. We work with individuals and organisations to be their best, achieve ambitions and be a success. We use Clarity4D and the concept of colour and 360 to build personal awareness and action plans.",
"offices": [
{
"location": "Peterborough, UK",
"address": "29 Warren Court, Hampton Hargate, Peterborough, PE7 8HA",
"coordinates": "52.5381398,-0.2713853000000199"
}
]
},
{
"id": 7,
"urlName": "vanessa-gomez",
"organization": "Vanessa Gómez (Freelance consultant)",
"customerLocations": "across Central America",
"willWorkRemotely": true,
"website": null,
"services": "Grow your staff to grow your business! With more than 20 years fostering organizational success for a broad range of companies, I can support you from start to end in uncovering and developing your staff talents, and help them take charge of their own growth.",
"offices": [
{
"location": "San José, Costa Rica",
"address": "Condominio Villas de Valencia 93, San Rafael de Escazú 10203, San José, Costa Rica",
"coordinates": "9.932159,-84.14062790000003"
}
]
},
{
"id": 8,
"urlName": "lead-tcml",
"organization": "LEAD TCM&L",
"customerLocations": "in Europe, UAE and Japan",
"willWorkRemotely": true,
"website": "http://www.leadtcml.com",
"services": "LEAD TCM&L is a Management Consulting and Organizational Development company specialized in evidence-based approaches to Change Management, Human Capital and Leadership Development. We use 360 feedback as an assessment tool in coaching, training, change initiatives and talent management. ",
"offices": [
{
"location": "Rotterdam, Netherlands",
"address": "Rivium Oostlaan 35a, 2909 LL Capelle aan den IJssel, The Netherlands",
"coordinates": "51.9107013,4.547834200000011"
}
]
},
{
"id": 9,
"urlName": "win-with-people",
"organization": "Win With People",
"customerLocations": "in the United States and Canada",
"willWorkRemotely": true,
"website": "http://www.winwithpeople.com/",
"services": "At Win With People, we provide coaching and consulting to bring out the best in people in companies and organizations. We offer behavioral assessments, executive coaching, and 360-degree feedback programs custom-tailored to meet our clients' needs and objectives.",
"offices": [
{
"location": "North Carolina, USA",
"address": "725 Kenmore Road, Chapel Hill, North Carolina USA",
"coordinates": "35.94970259999999,-79.0383625"
}
]
},
{
"id": 10,
"urlName": "leader-development",
"organization": "LeaderDevelopment, Inc.",
"customerLocations": "in the United States and Europe",
"willWorkRemotely": true,
"website": "http://www.leaderdevelopmentinc.com/",
"services": "We want to help you be an exceptional leader - whatever your role or level. We have created a unique, comprehensive and practical Leadership Framework to help you build your organization and career. We use Spidergap and other tools as a critical part of your leadership-development success.",
"offices": [
{
"location": "South Carolina, USA",
"address": "1911 Gadsden Street, Suite 201, Columbia, South Carolina 29201, USA",
"coordinates": "34.0091016,-81.04493960000002"
}
]
},
{
"id": 11,
"urlName": "beacon-search",
"organization": "Beacon Search",
"customerLocations": "in Asia Pacific",
"willWorkRemotely": true,
"website": "http://www.beacon-search.com/",
"services": "At Beacon we specialize in helping companies become and stay profitable by coaching their people assets in becoming better motivated, focused, and effective. We specialize in Executive Search, Executive Coaching and Career Coaching, and use Spidergap as one of our diagnostic tools.",
"offices": [
{
"location": "Singapore",
"address": "31st floor, Suntec Tower 2, 9 Temasek Boulevard, Singapore 038989",
"coordinates": "1.2957136,103.85872429999995"
}
]
},
{
"id": 12,
"urlName": "c2cod",
"organization": "C2C Organizational Development",
"customerLocations": "in Asia, USA and Europe",
"willWorkRemotely": true,
"website": "http://www.c2cod.com/",
"services": "C2C Organizational Development is a high-performing team of OD consultants, facilitators, and content designers who are passionate about seeing people and organizations work better together.",
"offices": [
{
"location": "Bangalore, India",
"address": "Rich Homes Building, 5/1 Richmond Road, Bangalore, India - 560 025",
"coordinates": "12.9657659,77.5998538"
},
{
"location": "Singapore",
"address": "1 Raffles Place, #20-61, Tower 2, Singapore 048616",
"coordinates": "1.284479,103.85108200000002"
}
]
},
{
"id": 13,
"urlName": "gallus-consulting",
"organization": "Gallus Consulting",
"customerLocations": "across the UK",
"willWorkRemotely": true,
"website": "http://www.gallusconsulting.com/",
"services": "We're strategy consultants with a difference - we work with organisations and their leaders to take them from strategy to reality. In our work with leaders we often use 360-degree feedback to identify capability gaps, improve self-awareness, and develop strategic and cultural alignment. Our aim is for believe-able leaders to emerge with the drive, capability and cultural fit to take strategy to reality.",
"offices": [
{
"location": "Northampton",
"address": "Newton House, Northampton Science Park, Moulton Park, Kings Park Road, Northampton, NN3 6LG",
"coordinates": "52.277409,-0.877935999999977"
},
{
"location": "London",
"address": "No1 Royal Exchange, London, EC3V 3DG",
"coordinates": "51.5136102,-0.08757919999993646"
},
{
"location": "Manchester",
"address": "3 Hardman Square, Spinningfields, Manchester, M3 3EB",
"coordinates": "53.47990859999999,-2.2510892999999896"
}
]
},
{
"id": 14,
"urlName": "dwconsulting",
"organization": "Darren Williams Consulting",
"customerLocations": "across Australia",
"willWorkRemotely": true,
"website": "http://www.dwconsulting.com.au/",
"services": "We specialize in Leadership Development and Executive Coaching. Ultimately, leadership development is a process of self development and Spidergap 360 is a great tool for raising awareness of our style and impact on others. We can work with you to design and deliver powerful learning opportunitities.",
"offices": [
{
"location": "Adelaide",
"address": "Adelaide, Australia",
"coordinates": "-34.9284989,138.60074559999998"
}
]
},
{
"id": 15,
"urlName": "lincoln-learning",
"organization": "Lincoln L&D",
"customerLocations": "across Australasia, SE Asia, Africa and the Middle East",
"willWorkRemotely": true,
"website": "http://www.lincolnlearning.com.au/",
"services": "Lincoln Learning & Development facilitates team performance, leadership development and management coaching programs. We take a practical, real-world perspective and look for actionable steps to bring about change.",
"offices": [
{
"location": "Adelaide",
"address": "Unley, SA 5061, Australia",
"coordinates": "-34.95,138.60000000000002"
}
]
},
{
"id": 16,
"urlName": "targetter",
"organization": "Targetter",
"customerLocations": "across Asia, Europe and Africa",
"willWorkRemotely": true,
"website": "https://www.targetter.de/",
"services": "We provide tailor-made leadership development programs and executive coaching engagements. Attendees take full personal responsibility, take action, and foster and grow themselves and their people. Their companies are more competitive, achieve better results and are more profitable.",
"offices": [
{
"location": "Bietigheim-Bissingen, Germany",
"address": "Kleinsachsenheimer Strasse 47, 74321 Bietigheim-Bissingen, Germany",
"coordinates": "48.96277,9.09699999999998"
}
]
},
{
"id": 17,
"urlName": "ask-leadership",
"organization": "Ask Leadership",
"customerLocations": "in the Caribbean, United States, Canada and UK",
"willWorkRemotely": true,
"website": null,
"services": "Ask Leadership is a vibrant business that works to build success for individuals and organizations around the world. Our primary focus is people and team development. The 360 tool is key to seeing where each person stands today and to track their progress as we work with them.",
"offices": [
{
"location": "Trinidad",
"address": "70 Caspian Cove, Westmoorings, Port of Spain, Trinidad",
"coordinates": "10.6792447,-61.56065180000002"
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.