Skip to content

Instantly share code, notes, and snippets.

@erikprice
erikprice / DisposeSignalUpstreamOfMerge.m
Created November 17, 2013 19:28
Test to verify that in a RACSignal subscription chain, the completed event on a signal downstream of a `+merge:` invokes the disposable of an upstream signal. (ReactiveCocoa)
it(@"should propagate disposal to signals upstream of a +merge: to which it is subscribed when it completes", ^{
__block BOOL disposed1 = NO;
__block BOOL disposed2 = NO;
RACSignal *upstream1 = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> _) {
return [RACDisposable disposableWithBlock:^{
disposed1 = YES;
}];
}];
RACSignal *upstream2 = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> _) {
return [RACDisposable disposableWithBlock:^{
@erikprice
erikprice / breadth_first.py
Created March 23, 2022 00:22
Illustration of breadth-first search for Hack.Diversity Learning Labs 2022-03-22
#!/usr/bin/env python
class Node:
def __init__(self, value=None, children=None):
self.value = value
self.children = children or []
self.visited = False
def make_graph():
graph = {}
@erikprice
erikprice / depth_first.py
Created March 23, 2022 00:22
Illustration of depth-first search for Hack.Diversity Learning Labs 2022-03-22
#!/usr/bin/env python
class Node:
def __init__(self, value=None, children=None):
self.value = value
self.children = children or []
self.visited = False
def make_graph():
graph = {}