-
Historia:
- Eich escribió el primer prototipo de JS en 10 dias en Mayo de 1995
- Creado en poco tiempo, sin restricciones, como en Java las Checked Exceptions o en C# los metodos finales.
- JavaScript Jabber Podcast con Brendan Eich: https://devchat.tv/js-jabber/124-jsj-the-origin-of-javascript-with-brendan-eich
- Aprender JavaScript me obligó a estudiar. Kudos a Pasku por la cantidad de recursos que me pasó.
- Scheme: Higher-order functions o functors, lexical scoping
- Lo mejor es su flexibilidad, es multiparadigma
-
Douglas Crockford Lectures on JavasScript:
This file contains 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 who_wins(cards_player1, cards_player2): | |
ranking = { | |
'2': 2, | |
'3': 3, | |
'4': 4, | |
'5': 5, | |
'6': 6, | |
'7': 7, | |
'8': 8, | |
'9': 9, |
This file contains 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 unittest | |
# TDD - Test-driven development. -> | |
# BDD - Behaviour driven development - Outside-in TDD - Mocks | |
# Inside-out TDD VS Outside-in TDD | |
# Paso 1: Definir una buena lista de requisitos - Piensa primero cobarde. | |
## | |
# Design principles: Less Astonishment/Surprise Principle |
This file contains 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 re | |
def sum_numbers_in(expression: str) -> int: | |
if expression is None or expression == "": | |
return 0 | |
if "," in expression: | |
tokens = expression.split(',') | |
total = 0 | |
for token in tokens: |
This file contains 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 sum_numbers_in(expression: str) -> int: | |
if expression is None or expression == "": | |
return 0 | |
if "," in expression: | |
tokens = expression.split(',') | |
return int(tokens[0]) + int(tokens[1]) | |
return int(expression) | |
class StringCalculatorTests(unittest.TestCase): |
This file contains 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
using System; | |
using System.Linq; | |
using System.Reflection; | |
using NUnit.Framework; | |
namespace Metaprogramming | |
{ | |
enum Role | |
{ | |
admin, |
This file contains 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
<div id="cards-gui-container"> | |
<label for="deck1">Deck1:</label> | |
<input id="deck1"/> | |
<br> | |
<label for="deck2">Deck2:</label> | |
<input id="deck2"/> | |
<input id="whoWinsButton" type="button" value="Who wins?"/> | |
<br> | |
<label id="result">The winner is...</label> |
This file contains 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
it ('populates store with data returned from server', (done) => { | |
stubApiClientToReturn({username: 'carlos'}); | |
simulateSearchFormSubmit({username: 'car'}); | |
expectStoredUsersToContainUsername('carlos', done); | |
}); | |
function expectStoredUsersToContainUsername(username, done){ | |
store.subscribe(eventuallyExpect(() => { |
This file contains 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
export const createPage = (serverApi, mapState) => { | |
return connect( | |
(state) => { | |
let mapping = { | |
report: state.report | |
}; | |
if (typeof(mapState) === 'function'){ | |
return Object.assign(mapping, mapState(state)); | |
} | |
return mapping; |
This file contains 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
let stubApi = {}; | |
let store; | |
let stubRouter = { | |
location: { | |
search: '', | |
query: { | |
toDay: '', | |
fromDay: '' | |
} | |
}, |