This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const input = 'R3, L2, L2, R4, L1, R2, R3, R4, L2, R4, L2, L5, L1, R5, R2, R2, L1, R4, R1, L5, L3, R4, R3, R1, L1, L5, L4, L2, R5, L3, L4, R3, R1, L3, R1, L3, R3, L4, R2, R5, L190, R2, L3, R47, R4, L3, R78, L1, R3, R190, R4, L3, R4, R2, R5, R3, R4, R3, L1, L4, R3, L4, R1, L4, L5, R3, L3, L4, R1, R2, L4, L3, R3, R3, L2, L5, R1, L4, L1, R5, L5, R1, R5, L4, R2, L2, R1, L5, L4, R4, R4, R3, R2, R3, L1, R4, R5, L2, L5, L4, L1, R4, L4, R4, L4, R1, R5, L1, R1, L5, R5, R1, R1, L3, L1, R4, L1, L4, L4, L3, R1, R4, R1, R1, R2, L5, L2, R4, L1, R3, L5, L2, R5, L4, R5, L5, R3, R4, L3, L3, L2, R2, L5, L5, R3, R4, R3, R4, R3, R1'; | |
| const { pos } = input.split(',').reduce( | |
| ({ dir, pos }, item) => { | |
| const trimmed = item.trim(); | |
| const turn = trimmed[0]; | |
| const steps = parseInt(trimmed.slice(1), 10); | |
| const newDir = ( | |
| turn === 'L' | |
| ? dir === 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Light Switch</title> | |
| </head> | |
| <body> | |
| <button type="button">Toggle</button> | |
| <script> | |
| const ws = new WebSocket('ws://127.0.0.1:8888/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const video = document.getElementsByTagName('video')[0]; | |
| const slider = document.createElement('input'); | |
| slider.type = 'range'; | |
| slider.min = 0.5; | |
| slider.max = 3; | |
| slider.step = 0.25; | |
| slider.value = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "pokemon": [{ | |
| "id": 1, | |
| "num": "001", | |
| "name": "Bulbasaur", | |
| "img": "http://www.serebii.net/pokemongo/pokemon/001.png", | |
| "type": [ | |
| "Grass", | |
| "Poison" | |
| ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| const Button = props => ( | |
| <button onClick={props.onClick}>Click me!</button> | |
| ); | |
| class Foo extends Component { | |
| constructor(props) { | |
| console.log('construyendo...'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { uniq, pluck, extractCampus } = require('./'); | |
| describe('uniq', () => { | |
| it('debería retornar un nuevo array sin elementos repetidos', () => { | |
| expect(uniq(['a', 'a', 'z', 'a', true, 0])).toEqual(['a', 'z', true, 0]); | |
| expect(uniq([1, 1, 1])).toEqual([1]); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.uniq = arr => arr.reduce( | |
| (prev, item) => (prev.indexOf(item) === -1) ? prev.concat(item) : prev, | |
| [], | |
| ); | |
| exports.pluck = (arr, prop) => arr.map(obj => obj[prop]); | |
| exports.extractCampus = cohortids => | |
| cohortids.map(item => item.slice(0, item.indexOf('-'))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sum = require('./sum'); | |
| describe('sum()', () => { | |
| it('should return 5 when arg a is 2 and arg b is 3', () => { | |
| expect(sum(2, 3)).toBe(5); | |
| }); | |
| it('should return 1 when arg a is 1 and arg b is 0', () => { | |
| expect(sum(1, 0)).toBe(1); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const time = require('./time'); | |
| describe('time()', () => { | |
| it('should return a number', () => { | |
| expect(typeof time()).toBe('number'); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const time = () => Date.now(); | |
| module.exports = time; |
NewerOlder