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 React from "react" | |
import Confetti from "react-confetti" | |
const size = 10 | |
export default function Playground() { | |
const [tiles, setTiles] = React.useState(getNewTiles) | |
const tileElements = tiles.map(tile => new Tile(tile)) | |
const isGameOver = new Set(tiles.map(tile => tile.value)).size === 1 | |
const onClick = () => setTiles(isGameOver ? initTiles() : generateTiles()) |
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 default class JobQueue { | |
constructor(collection, identifier, pendingJobs, queuedJobs) { | |
this.collection = collection; | |
this.identifier = identifier; | |
// All public, do not care about incapsulation | |
this.queue = []; | |
this.pendingJobs = pendingJobs; | |
this.queuedJobs = queuedJobs; |
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 default function JobQueue(collection, identifier, pendingJobs, queuedJobs) { | |
const queue = []; | |
this.collection = collection; | |
this.identifier = identifier; | |
this.enqueue = jobDescription => { | |
log.debug(`QUEUE - queue: ${jobDescription}`); | |
const queueEmpty = this.isEmpty(); |
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 default class JobQueue { | |
constructor(collection, identifier, pendingJobs, queuedJobs) { | |
this.collection = collection; | |
this.identifier = identifier; | |
const context = { | |
queue: [], | |
pendingJobs: pendingJobs, | |
queuedJobs: queuedJobs |
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
package org.maximf | |
object P50 { | |
def main(args: Array[String]) { | |
println(go(1000000)) | |
} | |
def go(limit: Long): Long = { | |
val primes = Primes.below(limit).toArray | |
val set = primes.toSet |