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
function solution(input, markers) { | |
const lines = input.split('\n'); | |
const strippedLines = lines.map((line) => { | |
let strippedLine = line; | |
markers.forEach((marker) => { | |
if (line.includes(marker)) { | |
const index = line.indexOf(marker); | |
strippedLine = line.slice(0, index); | |
} | |
}); |
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
def decode_message(input) | |
words = input.split("\n") | |
letters = [{}, {}, {}, {}, {}, {}] | |
words.each do |word| | |
word.each_char.with_index do |char, index| | |
if letters[index].key?(char) | |
letters[index][char] = letters[index][char] + 1 | |
else | |
letters[index][char] = 1 | |
end |
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
def deliver_presents(moves) | |
total_visits = 1 | |
start_location = [0, 0] | |
total_houses = [start_location] | |
new_location = start_location | |
moves.each_char do |move| | |
x, y = new_location | |
if move == '>' | |
new_location = [x + 1, y] | |
elsif move == '<' |
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 mostrar = false | |
const myPromise = new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (mostrar) { | |
resolve('hello world!'); | |
} else { | |
reject(Error('hello there!')); | |
} | |
}, 3000) | |
}); |
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 searchIcon = document.getElementById('search-icon'); | |
const searchInput = document.getElementById('search-input'); | |
searchIcon.addEventListener('click', () => { | |
searchInput.style.width = '200px'; | |
searchInput.focus(); | |
}); |
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
.wrapper { | |
width: 900px; | |
margin: auto; | |
} | |
ul { | |
padding: 0; | |
list-style: none; | |
} |
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
>>> class Televisor(object): | |
... def __init__(self,marca): | |
... self.__marca = marca | |
... self.encendido = False | |
... def encenderT(self): | |
... if self.encendido == False: | |
... self.encendido = True | |
... else: | |
... print "El televisor ya estaba encendido" | |
... def apagarT(self): |
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
# -*- coding: utf-8 -*- | |
import random | |
def lanzar_dado(): | |
return 1 + random.randrange(6) | |
def num_dados(n): | |
lista = [] | |
for i in range(n): | |
lista += [lanzar_dado()] |
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
# -*- coding: utf-8 -*- | |
import random | |
def lanzar_dado(): | |
return 1 + random.randrange(6) | |
def num_dados(n): | |
lista = [] | |
for i in range(n): | |
lista += [lanzar_dado()] |