Skip to content

Instantly share code, notes, and snippets.

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: '
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)
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'") {
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")
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)))
[
{
"id":"1",
"title":"Plan 1 title",
"description":"Plan 1 description",
"instructions":[
{
"id":"1_1",
"title":"Instruction 1"
},
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] = [];
@pellekrogholt
pellekrogholt / gist:6791298
Created October 2, 2013 09:37
window example so its possible to call outside the coffee wrapper - and a function call within the - simple modified version of the one in "CoffeeScript Application Development"
# 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
@pellekrogholt
pellekrogholt / collision.coffee
Last active December 24, 2015 07:09
could find the gist for http://mbostock.github.io/d3/talk/20111018/collision.html so here is a replication
# 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
@pellekrogholt
pellekrogholt / README.md
Created September 30, 2013 08:23 — forked from mbostock/.block

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.