Skip to content

Instantly share code, notes, and snippets.

View carlosble's full-sized avatar

Carlos Ble carlosble

View GitHub Profile
<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>
@carlosble
carlosble / jsdaycan2017_js_engancha_resumen.md
Last active April 7, 2020 22:08
Por que JavaScript engancha, #JSDayCAN2017
  • 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:

@carlosble
carlosble / metaprogramming.cs
Created June 22, 2020 14:01
Decorator pattern and metaprogramming with C#
using System;
using System.Linq;
using System.Reflection;
using NUnit.Framework;
namespace Metaprogramming
{
enum Role
{
admin,
@carlosble
carlosble / kata.py
Created July 6, 2020 18:57
string calculator kata python
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):
@carlosble
carlosble / kata.py
Created July 7, 2020 15:48
String calculator Kata 2
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:
@carlosble
carlosble / tests.py
Created July 7, 2020 15:49
String calculator tests
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
@carlosble
carlosble / cards.py
Created July 7, 2020 18:49
Cards game
def who_wins(cards_player1, cards_player2):
ranking = {
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
@carlosble
carlosble / carts_tests.py
Created July 7, 2020 18:50
cards_tests.py
import unittest
from cards import who_wins
# ToDo List:
# diferente cantidad de cartas -> raise error
# ['1'],['3','4'] -> raise error
# cartas con invalidos,
# 'W' -> raise error
class Sensor:
"""Lo vamos a simular"""
def is_detecting_movement(self) -> bool:
pass
class Recorder:
"""Lo vamos a simular"""
def start_recording(self):
import unittest
from camera import Controller, Sensor, Recorder
class CameraTests(unittest.TestCase):
def test_asks_the_recorder_to_stop_recording_when_no_information_received_from_sensor(self):
sensor = Sensor() # mocks
recorder = Recorder() # mocks
self.called = False