Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.
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
renderBodyContentOn: html | |
|modalDOMElement microphone audioDomElement audioUrl| | |
html button | |
with: 'Add message'; | |
class: 'btn btn-primary'; | |
onClick: [modalDOMElement asJQuery modal: 'show']. | |
modalDOMElement := html div class:'modal fade'; with:[ | |
html style with: ' |
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
test("proper inserts and lookups and remove") { | |
val topNode = system.actorOf(Props[BinaryTreeSet]) | |
topNode ! Contains(testActor, id = 1, 1) | |
expectMsg(ContainsResult(1, false)) | |
topNode ! Insert(testActor, id = 2, 1) | |
expectMsg(OperationFinished(2)) | |
topNode ! Remove(testActor, id = 4, 1) |
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
test("Test empty tree 'Contains'") { | |
// behind the scene this on create a node actor - follow props: Props(classOf[BinaryTreeNode], elem, initiallyRemoved) | |
val testNode = system.actorOf(BinaryTreeNode.props(0, true)) | |
testNode ! Contains(testActor, id = 1, 0) | |
expectMsg(ContainsResult(1, false)) | |
} | |
test("Test empty tree 'Insert'") { |
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 week12 | |
import akka.actor.Actor | |
import akka.actor.Props | |
import akka.event.LoggingReceive | |
class TransferMain extends Actor { | |
val accountA = context.actorOf(Props[BankAccount], "accountA") | |
val accountB = context.actorOf(Props[BankAccount], "accountB") |
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
test("recovered standalone") { | |
val ex = new NoSuchElementException | |
// exception in the end | |
val o1 = Observable(1, 2, 3) ++ Observable(ex) | |
val o1Revocered = o1.recovered | |
assert(o1Revocered.toBlockingObservable.toList === List(Success(1), Success(2), Success(3), Failure(ex))) | |
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
[ | |
{ | |
"id":"1", | |
"title":"Plan 1 title", | |
"description":"Plan 1 description", | |
"instructions":[ | |
{ | |
"id":"1_1", | |
"title":"Instruction 1" | |
}, |
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
function nestCollection(model, attributeName, nestedCollection) { | |
//setup nested references | |
for (var i = 0; i < nestedCollection.length; i++) { | |
model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
} | |
//create empty arrays if none | |
nestedCollection.bind('add', function (initiative) { | |
if (!model.get(attributeName)) { | |
model.attributes[attributeName] = []; |
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
# we have window to make the class accessible outside the coffee wrapper | |
# e.g.: | |
# > train = new Train(35) | |
# > train.funcwithinclass() | |
class window.Train | |
constructor: (numCars, type="diesel") -> | |
@type = type | |
@numCars = numCars | |
@load = 0 | |
@capacity = numCars * 100 |
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
# w = 1280, h = 800 | |
collide = (node) -> | |
r = node.radius + 16 | |
nx1 = node.x - r | |
nx2 = node.x + r | |
ny1 = node.y - r | |
ny2 = node.y + r | |
(quad, x1, y1, x2, y2) -> | |
if quad.point and (quad.point isnt node) | |
x = node.x - quad.point.x |