Skip to content

Instantly share code, notes, and snippets.

def recursive_subsets(array)
return [] if array.empty?
inner_array = array.first
if array.length == 1
return inner_array.map { |item| [item] }
end
results = []
@rorysaur
rorysaur / collection.ts
Created February 21, 2015 22:38
typescript stack
interface Collection {
push(value: any): void;
pop(): any;
peek(): any;
isEmpty(): boolean;
}
class Stack implements Collection {
top: any
@rorysaur
rorysaur / backbone_app_bases.js
Created April 26, 2014 22:04
purpose of app-wide bases in backbone
App.Views.ViewBase = Backbone.View.extend({
childViews: [],
addChild: function(view) {
// etc
},
close: function() {
this.childViews.forEach(function(childView) {
childView.close();