Here to allow for recursion
559650
private List<Location> getAllSubLocations(Location location) {
		List<Location> flatSubLocations = new ArrayList<Location>();
		for (Location l : location.getSubLocations()) {
			if (l.isComplex()) {
				flatSubLocations.addAll(getAllSubLocations(l));
			}
			else {
				flatSubLocations.add(l);
			}
		}
		return flatSubLocations;
	}
415564
public static <T> T eachWithIndex(T self, Closure closure) {
        final Object[] args = new Object[2];
        int counter = 0;
        for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {
            args[0] = iter.next();
            args[1] = counter++;
            closure.call(args);
        }
        return self;
    }
1215439
function every(arr, cb, thisArg) {
  cb = makeIterator(cb, thisArg);
  var result = true;
  if (arr == null) {
    return result;
  }

  var len = arr.length;
  var i = -1;

  while (++i < len) {
    if (!cb(arr[i], i, arr)) {
      result = false;
      break;
    }
  }
  return result;
}
212234
function some(arr, iter) {
    arr = Immutable.List(arr);

    return arr.reduce(function(prev, elem, i) {
        return prev.then(function(val) {
            if (val) return val;

            return iter(elem, i);
        });
    }, Q());
}
285806
def doit(self, classes=None, recursive=True, **kwargs):
        
        return super().doit(classes, recursive, **kwargs)
1173811
function (index, count) {
        index = index || 0;
        count = count || this.length;
        validateListIndex(this, index + count - 1);

        var arr = this.slice(index, index + count).reverse(),
            len = arr.length;

        while (len-- > 0) {
            this[len + index] = arr[len];
        }

        return this;
    }
1006376
function forOwn(obj, fn, thisObj){
        forIn_1(obj, function(val, key){
            if (hasOwn_1(obj, key)) {
                return fn.call(thisObj, obj[key], key, obj);
            }
        });
    }
932629
def create_recursive(path)
      recursive = path.split("/")
      directory = ""
      recursive.each do |sub_directory|
        directory += sub_directory + "/"
        Dir.mkdir("#{directory}") unless (File.directory? directory)
      end
    end
494390
function(_hook, _fun) {
      if(this.$$cb && this.$$cb[_hook]) {
        var idx = Utils.indexWhere(this.$$cb[_hook], function(e) { return e === _fun; });
        if(idx !== -1) this.$$cb[_hook].splice(idx, 1);
      }
      return this;
    }
720086
function(options) {
    var recurse = function(options) {
      _.each(options, function(value, key) {
        if (_.isFunction(value)) {
          options[key] = value();
        }
        else if (_.isObject(value)) {
          options[key] = recurse(value);
        }
      });
      return options;
    };

    return recurse(options);
  }
1171836
def recursive_derived(self):
        """"""
        if self._recursive_derived is None:
            to_go = self.derived[:]
            all_derived = []
            while to_go:
                derive = to_go.pop()
                if derive not in all_derived:
                    all_derived.append(derive)
                    to_go.extend(derive.related_class.derived)
            self._recursive_derived = all_derived
        return self._recursive_derived
843486
private void recursivels(FileSystem fs, Path p, List<FileStatus> out) 
  throws IOException {
    FileStatus fstatus = fs.getFileStatus(p);
    if (!fstatus.isDir()) {
      out.add(fstatus);
      return;
    }
    else {
      out.add(fstatus);
      FileStatus[] listStatus = fs.listStatus(p);
      for (FileStatus stat: listStatus) {
        recursivels(fs, stat.getPath(), out);
      }
    }
  }
354239
function() {
    var op
      , node = this.defined();
    while (op =
         this.accept('**')
      || this.accept('*')
      || this.accept('/')
      || this.accept('%')) {
      this.operand = true;
      if ('/' == op && this.inProperty && !this.parens) {
        this.stash.push(new Token('literal', new nodes.Literal('/')));
        this.operand = false;
        return node;
      } else {
        if (!node) this.error('illegal unary "' + op + '", missing left-hand operand');
        node = new nodes.BinOp(op.type, node, this.defined());
        this.operand = false;
      }
    }
    return node;
  }
491687
function recursive (node, depth, index) {
    let hashLeft
    let hashRight
    let summingBuffer

    // case with single node in tree
    if (depth === 0 && node.val !== undefined) {
      return getHash(node.val, depth, index * 2)
    }

    if (node.left === undefined) {
      throw new Error('Left node is missed.')
    }
    if (typeof node.left === 'string') {
      if (!validateHexadecimal(node.left)) {
        throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
      }
      hashLeft = node.left
    } else {
      if (!isObject(node.left)) {
        throw new TypeError('Invalid type of left node.')
      }
      if (node.left.val !== undefined) {
        hashLeft = getHash(node.left.val, depth, index * 2)
      } else {
        hashLeft = recursive(node.left, depth + 1, index * 2)
      }
    }

    if (depth === 0) {
      rootBranch = 'right'
    }

    if (node.right !== undefined) {
      if (typeof node.right === 'string') {
        if (!validateHexadecimal(node.right)) {
          throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
        }
        hashRight = node.right
      } else {
        if (!isObject(node.right)) {
          throw new TypeError('Invalid type of right node.')
        }

        if (node.right.val !== undefined) {
          hashRight = getHash(node.right.val, depth, index * 2 + 1)
        } else {
          hashRight = recursive(node.right, depth + 1, index * 2 + 1)
        }
      }

      summingBuffer = new Uint8Array(64)
      summingBuffer.set(hexadecimalToUint8Array(hashLeft))
      summingBuffer.set(hexadecimalToUint8Array(hashRight), 32)
      return hash(summingBuffer)
    }

    if (depth === 0 || rootBranch === 'left') {
      throw new Error('Right leaf is missed in left branch of tree.')
    }
    summingBuffer = hexadecimalToUint8Array(hashLeft)
    return hash(summingBuffer)
  }
244176
function () {
            var tmp, a = this.val;

            tmp = a[1];
            a[1] = a[3];
            a[3] = tmp;
            tmp = a[2];
            a[2] = a[6];
            a[6] = tmp;
            tmp = a[5];
            a[5] = a[7];
            a[7] = tmp;

            return this;
        }
878195
def prevent_recursion!(template)
      # If this template is not a real file it cannot ever conflict.
      return unless template.real_source_path

      caller_templates = template_nesting.select do |t|
        t.real_source_path == template.real_source_path
      end

      # We're good, no deeper recursion then MAX_ALLOWED_TEMPLATE_NESTING
      return if caller_templates.length <= MAX_ALLOWED_TEMPLATE_NESTING

      err = "Recursive render detected for '#{template.source_path}'"
      err += " in '#{current_template.source_path}'"

      raise ArgumentError, err
    end
807098
function() {
			if (this.parent) {
				var ix = this.parent.children.indexOf(this);
				if (~ix) {
					this.parent.children.splice(ix, 1);
				}
			}
			
			return this;
		}