Any method that ends with "Callbacks" can return an array of
callbacks. This is useful for traits that require to add some callbacks,
so they don't have to be manually called by the class implementing the trait.
484556
private function pluggedCallbacks()
    {
        $callbacks = [];
        
        foreach (self::getReflection()->getMethods() as $method) {
            $methodName = $method->getName();
            if (
                strpos($methodName, 'Callbacks') === strlen($methodName) - 9
                && strpos($method->getDeclaringClass()->getName(), 'Rails') !== 0
            ) {
                $callbacks = array_merge($callbacks, $this->$methodName());
            }
        }
        
        return $callbacks;
    }
1235013
function getMethods(obj) {
    var result = [];
    for (var id in obj) {
        try {
            if (typeof (obj[id]) == "function") {
                result.push(id);
            }
        }
        catch (err) {
            result.push(id + ": inaccessible");
        }
    }
    return result;
}
1189344
function() {
    var callbacks = this._callbacks;
    var contexts = this._contexts;
    if (callbacks) {
      ("production" !== "development" ? invariant(
        callbacks.length === contexts.length,
        'Mismatched list of contexts in callback queue'
      ) : invariant(callbacks.length === contexts.length));
      this._callbacks = null;
      this._contexts = null;
      for (var i = 0, l = callbacks.length; i < l; i++) {
        callbacks[i].call(contexts[i]);
      }
      callbacks.length = 0;
      contexts.length = 0;
    }
  }
108546
function(callback, options, params) {
        var options = options || ((_.isObject(callback) && !_.isFunction(callback)) ? callback : {});
        if (params) {
            options = _.extend({}, options, params);
        }

        return options
    }
39254
def close(self):
        '''
        '''
        if self.closed: return
        for func,arglist in self.callbacks:
            apply(func, arglist)
        self.closed = True
783662
function(arg, callback) {
    if (!arg || typeof arg !== 'object') return;

    if (arg instanceof Array) {
      arg.forEach(callback);
    } else {
      for (var k in arg) {
        callback(arg[k], k);
      }
    }
  }
1272774
public function __map($callback):array {

		if(!\is_callable($callback)){
			throw new TraitException('invalid callback');
		}

		$return = [];

		foreach($this->array as $index => $element){
			$return[$index] = \call_user_func_array($callback, [$element, $index]);
		}

		return $return;
	}
766066
function() {
      var scope = context.getScope();
      while (scope) {
        var node = scope.block;
        var isClass = node.type === 'ClassExpression';
        var isFunction = /Function/.test(node.type); // Functions
        var isMethod = node.parent && node.parent.type === 'MethodDefinition'; // Classes methods
        var isArgument = node.parent && node.parent.type === 'CallExpression'; // Arguments (callback, etc.)
        // Stop moving up if we reach a class or an argument (like a callback)
        if (isClass || isArgument) {
          return null;
        }
        // Return the node if it is a function that is not a class method
        if (isFunction && !isMethod) {
          return node;
        }
        scope = scope.upper;
      }
      return null;
    }
1247600
function(events, callback, context) {
      var calls, event, node, tail, list;
      if (!callback) {
        return this;
      }
      events = events.split(eventSplitter);
      calls = this._callbacks || (this._callbacks = {});

      // Create an immutable callback list, allowing traversal during
      // modification.  The tail is an empty object that will always be used
      // as the next node.
      event = events.shift();
      while (event) {
        list = calls[event];
        node = list ? list.tail : {};
        node.next = tail = {};
        node.context = context;
        node.callback = callback;
        calls[event] = { tail: tail, next: list ? list.next : node };
        event = events.shift();
      }

      return this;
    }
533990
function CallbackArray(){
    this.callbacks = new SortedArray(
        function(a,b){
            if (a.uid < b.uid) {return -1;};
            if (a.uid > b.uid) {return  1;};
            if (a.counter < b.counter){ return -1;};
            if (a.counter > b.counter){ return  1;};
            return 0;
        });
}
645501
function isCallbacksObject(callbacks) {
    return callbacks && subscribeEvents.some(function (event) {
        return _.isFunction(callbacks[event]);
    });
}
1261395
def callback(*names)
      names.each do |name|
        self.class_eval do
          define_method name, ->(*args, &block) do
            @callbacks ||= {}
            if block
              @callbacks[name] = block
            elsif @callbacks[name]
              @callbacks[name].call(*args)
            end
          end
        end
      end
    end
702468
function() {
		var i = 0;
		while (i<_callbacks.length) {
			var deps = _callbacks[i][0],
				func = _callbacks[i][1],
				n = 0;
			while (n<deps.length) {
				if (areDeepDepsDefined(deps[n])) {
					deps.splice(n, 1);
				}
				else {
					n++;
				}
			}
			if (!deps.length) {
				_callbacks.splice(i, 1);
				if (func != null) {
					setTimeout(func, 0);
				}
			}
			else {
				i++;
			}
		}
	}
244944
function (callback) {
            var promise = new Promise();
            this.addCallback(function () {
                try {
                    when(isFunction(callback) ? callback.apply(this, arguments) : callback).then(promise);
                } catch (e) {
                    promise.errback(e);
                }
            });

            this.addErrback(function () {
                try {
                    when(isFunction(callback) ? callback.apply(this, arguments) : callback).then(promise);
                } catch (e) {
                    promise.errback(e);
                }
            });
            return promise.promise();
        }
950213
function(authMethods){
      var _method = {};
      var _methodName;

      try{
        _.each(authMethods, function(method){
          _methodName = method.name;
          method = _.merge(require('../../'+_methodName), method);
          _method[method.authType] = method;
        });
      }catch(e){
        this._errorHandler(_methodName);
      }

      return _method;
    }
990300
function (methods) {
    this.lazyLoaders();
    var loaders = this.loaders;
    var self = this;

    utils.arrayify(methods).forEach(function (method) {
      self.define(method, function() {
        return loaders[method].apply(loaders, arguments);
      });
    });
  }
498043
function (callback) {
                var result = new Array(this.length), boundCallback = _gpfArrayBind(callback, arguments);
                _gpfArrayForEachOwn(this, function (item, index, array) {
                    result[index] = boundCallback(item, index, array);
                });
                return result;
            }