- Un sitio web expone una url publicamente.
- Uno o mas usuarios pueden entrar a esa url publica.
- Al entrar a esa url el browser muestra un circulo.
- Cuando alguna de las teclas arriba, abajo, derecha o izquierda es presionada el circulo se mueve en la direccion indicada por la tecla presionada.
- Cualquier movimiento de el circulo debera ser visto en las terminales de los clientes en tiempo real.
- Uno o mas clientes pueden conectarse por linea de comando al sitio para ver en tiempo real como se mueve el circulo, cualquier movimiento de el circulo debe reflejarse en la terminal de el cliente.
- La terminal de el cliente dibujara todos los circulos de todos los usuarios que se conecten al sitio y podra monitorear los movmientos de los circulos en tiempo real.
- En cada sitio web de cada usuario moviendo un circulo debera poder ver cada uno de los otros circulos de los otros sitios web.
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
"./mypackage" | |
) | |
// The Bla1 example tests if the output matches |
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 word_combinations(words, original_set_size = words.count, start_index = 0, end_index = words.count - 1, combinations = 1) | |
words[start_index..end_index].each do |combination| | |
words[0..original_set_size - 1].each do |original_combination| | |
unless combination.include?(original_combination.first) | |
new_combination = (combination + original_combination).sort | |
unless words.include?(new_combination) | |
words << new_combination | |
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
#import "Bob.h" | |
@implementation Bob | |
- (NSString *) hey: (NSString *) message { | |
if ([self isEmpty:message]) { | |
return @"Fine, be that way."; | |
} else if ([self isScreaming:message]) { |
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 update_hto_state | |
Rails.logger.info "Here we go" | |
if hto? | |
determine_hto_state | |
end | |
update_attributes_without_callbacks(hto_state: hto_state) | |
if hto_state_changed? |
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 static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
import org.junit.Ignore; | |
import org.junit.Rule; | |
import org.junit.Before; | |
import org.junit.rules.ExpectedException; | |
import org.junit.runner.RunWith; | |
import org.junit.runners.JUnit4; |
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
require 'ruby-prof' | |
def prime(n) | |
limit = n | |
numbers = Array.new(n + 1) { true } | |
start = 2 | |
primes = [] | |
loop do | |
numbers[start] && primes << start |
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
require 'minitest/autorun' | |
SortSnail = -> (elements, result = []) { | |
return result if elements.empty? | |
bottom_limit = 0 | |
top_limit = elements.count - 1 | |
loop do | |
result.concat elements[bottom_limit][bottom_limit..top_limit] |
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
2.0.0-p247 |
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
require 'spec_helper' | |
SP = ->(graph, from_node, to_node, nodes = Hash.new(0), visited = [], i = 0) { | |
return nodes[from_node] if from_node == to_node | |
neighbours = graph[from_node].reject {|k, v| visited.include?(k) } | |
neighbours.each do |k, v| | |
if nodes[k] == 0 || nodes[from_node] + v < nodes[k] | |
nodes[k] = nodes[from_node] + v |