Skip to content

Instantly share code, notes, and snippets.

View AlexJuarez's full-sized avatar

Alex Juarez AlexJuarez

View GitHub Profile
const m = 10;
const n = 10;
const enemyShips = [];
class Ship {
constructor(x1, y1, x2, y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
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;
_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) {
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 '..':

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]
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],

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