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
// La funcion llamada 'sumaTodosPrimos' recibe como argumento un array de enteros. | |
// y debe devolver la suma total entre todos los numeros que sean primos. | |
// Pista: un número primo solo es divisible por sí mismo y por 1 | |
// Nota: Los números 0 y 1 NO son considerados números primos | |
// Ej: | |
// sumaTodosPrimos([1, 5, 2, 9, 3, 4, 11]) devuelve 5 + 2 + 3 + 11 = 21 | |
function sumaTodosPrimos(numeros) { | |
const primos = numeros.filter(numero => esPrimo(numero)); | |
const sumador = (accumulador, valorActual) => accumulador + valorActual; |
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
Xft.dpi: 96 | |
Xft.antialias: true | |
Xft.hinting: true | |
Xft.rgba: rgb | |
Xft.autohint: false | |
Xft.hintstyle: hintslight | |
Xft.lcdfilter: lcddefault | |
xvt.color12: rgb:5c/5c/ff | |
XTerm*background: #222D31 |
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
class MyClass | |
@@my_class_variable = "Class variable content." | |
def initialize | |
@my_instance_variable = "Instance variable content." | |
end | |
# Class methods have a "self." before their name. For now we won't go into the details | |
# on why it is that way. | |
def self.thing_my_class_does |
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
public | |
def greet(who) | |
"Hi, #{who}!" | |
end |
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
class Dog | |
def initialize(name) | |
@name = name | |
end | |
def bark | |
puts "woof!" | |
end | |
end |
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
class Dragon | |
def initialize | |
# ... | |
end | |
def fly | |
take_off | |
100.times do | |
move_wings(:horizontally) |
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
require "cuba" | |
require "mote" | |
require "mote/render" | |
Cuba.plugin Mote::Render | |
require_relative "controllers/pages" | |
require_relative "controllers/tasks" | |
require_relative "db/data_store" |
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
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.around(:each) do |example| | |
DatabaseCleaner.cleaning do |
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
process Employee { | |
while true { | |
serve_customer(pop(queue)) | |
} | |
} | |
process Customer[c = 0 to N - 1] { | |
while timeout[c] < 10 { | |
p(wait_a_minute) | |
} |
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
sem arrived[0..E - 1] = ([E] 0) | |
sem start_working[0..E - 1] = ([E] 0) | |
sem finish_task_mutex = 1 | |
int remaining_tasks = T | |
int tasks_done[0..E - 1] = ([E] 0) | |
task tasks[0..T - 1] = ([T] generate_task()) | |
reward rewards[0..E - 1] = ([E] null) |
NewerOlder