Skip to content

Instantly share code, notes, and snippets.

View AlexJuarez's full-sized avatar

Alex Juarez AlexJuarez

View GitHub Profile

Instructions

Hello! Please complete the following problems and send the solution to web@everlane.com. When you are solving the Ruby question, you may instead opt to use a language of your choice, as long as that language isn't named Java or C#.

JavaScript

{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],

Front End Engineering question Given an array, return it's flattend structure.

[1, [2, [3]]] -> [1, 2, 3]

[1, [2, 3], 4] -> [1, 2, 3, 4]

possible total 24 points

  • result [4]
const isRelative = filePath => filePath.charAt(0) === '.';
const normalizePath = (context, filePath) => {
const out = context.split('/').filter(c => c).slice(0, -1);
filePath.split('/').forEach((token) => {
switch (token) {
case '.':
case '':
break;
case '..':
_onUpdate = (predicate: (item: Item) => boolean, update: (item: Item) => Item) => {
const { data, onUpdate } = this.props;
onUpdate(group => group.id === data.id, (group) => {
const items = group.items.map((item) => {
if (!predicate(item)) {
return null;
}
return update(item);
});
if (items.filter(i => i).size) {
import { List } from 'immutable';
import Item from './records/Item';
import Group from './records/Group';
const safeSet = (item, field, val) => {
if (item[field] !== val) {
return item.set(field, val);
}
return item;
};
const isActive = (name, activeNames = []) => activeNames.indexOf(name) !== -1;
const m = 10;
const n = 10;
const enemyShips = [];
class Ship {
constructor(x1, y1, x2, y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
@AlexJuarez
AlexJuarez / Mastermind-solver.js
Created November 28, 2017 03:34
Write a way to play mastermind.
// The other player starts with a code that you are trying to guess
// the code is 4 digits 1-6, on each guess the other player will
// tell you the number of digits in your guess that are in the final solution
// and the exact number of digits that matches.
// e.g. code: '1234', guess: '1111' => '1 1'
const parse = (code) => code.split('').map((n) => parseInt(n, 10));
const MASTER_CODE = parse('1234');
{
"workbench.iconTheme": "vscode-icons",
"editor.tabSize": 2,
"terminal.integrated.fontFamily": "Source Code Pro for Powerline",
"window.zoomLevel": 0,
}
@AlexJuarez
AlexJuarez / Path.js
Last active October 31, 2018 18:03
Ast walker and modifier
class Path {
constructor(node, parent = null, key = null) {
this.node = node;
this.parent = parent;
this.key = key;
}
replace(node) {
node.leadingComments = [...(this.node.leadingComments || [])];
node.trailingComments = [...(this.node.trailingComments || [])];