add/remove functions
325092
function add(id, template, instances){
  templates[id] = {
    template: template,
    instances: instances
  };
}
71874
def _add_remove(self, action, album, objects, object_type=None,
                    **kwds):
        """"""
        # Ensure we have an iterable of objects
        if not isinstance(objects, collections.Iterable):
            objects = [objects]

        # Extract the type of the objects
        if object_type is None:
            object_type = objects[0].get_type()

        for i, obj in enumerate(objects):
            if isinstance(obj, TroveboxObject):
                # Ensure all objects are the same type
                if obj.get_type() != object_type:
                    raise ValueError("Not all objects are of type '%s'"
                                     % object_type)
                # Extract the ids of the objects
                objects[i] = obj.id

        result = self._client.post("/album/%s/%s/%s.json" %
                                   (self._extract_id(album),
                                    object_type, action),
                                   ids=objects, **kwds)["result"]

        # API currently doesn't return the updated album
        # (frontend issue #1369)
        if isinstance(result, bool): # pragma: no cover
            result = self._client.get("/album/%s/view.json" %
                                      self._extract_id(album))["result"]
        return Album(self._client, result)
1334610
function ( obj, fn ) {
		if ( typeof fn !== "function" ) {
			throw new Error( label.error.invalidArguments );
		}

		var remove = [];

		array.each( obj, function ( i ) {
			if ( fn( i ) !== false ) {
				remove.push( i );
			}
			else {
				return false;
			}
		});

		array.each( remove, function ( i ) {
			array.remove( obj, array.index( obj, i) );
		});

		return obj;
	}
1107985
def remove(self, name, func):
        '''  '''
        was_empty = self._empty()
        if name in self.hooks and func in self.hooks[name]:
            self.hooks[name].remove(func)
        if self.app and not was_empty and self._empty(): self.app.reset()
420786
def add(self, name, func):
        '''  '''
        if name not in self.hooks:
            raise ValueError("Unknown hook name %s" % name)
        was_empty = self._empty()
        self.hooks[name].append(func)
        if self.app and was_empty and not self._empty(): self.app.reset()
938717
function() {
  var args = Array.prototype.slice.call(arguments)
  //callback is null
  args.length == 2 && args.push(null)
  args.push({ mode: 'remove' })
  select.apply(this, args)
}
457834
def connect_cancel(self, functions):
        '''
        '''
        self._cancel_functions = []
        for func in functions:
            if isinstance(func, basestring) and hasattr(self, func) and callable(getattr(self, func)):
                self._cancel_functions.append(getattr(self, func))
            elif callable(func):
                self._cancel_functions.append(func)
            else:
                raise ValueError("Unknown function %s" % str(func))
256145
function remove(/* values... */) {
  var values = this.values
  var index = arguments.length
  var position

  while (index--) {
    position = values.indexOf(arguments[index])

    if (position !== -1) {
      values.splice(position, 1)
    }
  }

  return this
}
41878
function(el) {
            if (typeof el.remove === 'function')
                el.remove();
            else if (el.parentElement)
                el.parentElement.removeChild(el);
        }
1200281
public function addFunction(&$function)
    {
        if (isset($this->_functions[$function->name()])) {
            $phpdoctor =& $this->_root->phpdoctor();
            echo "\n";
            $phpdoctor->warning('Found function '.$function->name().' again, overwriting previous version');
        }
        $this->_functions[$function->name()] =& $function;
    }
939760
function removeListener(attr,func,child,update)
        {
          if(typeof func !== 'function') return bind;

          var isInput = (['value','checked'].indexOf(attr) !== -1),
              isStyle = (_allStyles.indexOf(attr) !== -1),
              listeners,
              x;

              function cut(attr,list)
              {
                var listenerFuncs = list[attr],
                    len = listenerFuncs.length;
                for(x=0;x<len;x++)
                {
                  if(listenerFuncs[x].toString() === func.toString())
                  {
                    listenerFuncs.splice(x,1);
                  }
                }
              }

          if(this.toString() !== bind.toString())
          {
            if(child)
            {
              var children = this.querySelectorAll('*'),
                  len = children.length;
              if(isStyle)
              {
                listeners = (update ? '_childStyleUpdateListeners' : '_childStyleListeners');
                cut(attr,this.attrListeners()[listeners]);
                listeners = (update ? '_parentStyleUpdateListeners' : '_parentStyleListeners');
              }
              else
              {
                if(attr === _all)
                {
                  listeners = (update ? '_childStyleUpdateListeners' : '_childStyleListeners');
                  cut(attr,this.attrListeners()[listeners]);
                }
                listeners = (update ? '_childAttrUpdateListeners' : '_childAttrListeners');
                cut(attr,this.attrListeners()[listeners]);
                listeners = (update ? '_parentAttrUpdateListeners' : '_parentAttrListeners');
              }
              for(x=0;x<len;x++)
              {
                var parents = children[x].attrListeners()[listeners][attr],
                    parentLen = parents.length;
                for(var i=0;i<parentLen;i++)
                {
                  if(parents[i].isEqualNode(this))
                  {
                    parents.slice(i,1);
                  }
                }
                if(attr === _all)
                {
                  listenersStyle = (update ? '_parentStyleUpdateListeners' : '_parentStyleListeners');
                  var parents = children[x].attrListeners()[listeners][attr],
                      parentLen = parents.length;
                  for(var i=0;i<parentLen;i++)
                  {
                    if(parents[i].isEqualNode(this))
                    {
                      parents.slice(i,1);
                    }
                  }
                }
              }
            }
            else
            {
              if(isStyle)
              {
                listeners = (update ? '_styleUpdateListeners' : '_styleListeners');
                cut(attr,this.attrListeners()[listeners]);
              }
              else
              {
                if(attr === _all)
                {
                  listeners = (update ? '_styleUpdateListeners' : '_styleListeners');
                  cut(attr,this.attrListeners()[listeners]);
                }
                listeners = (update ? '_attrUpdateListeners' : '_attrListeners');
                cut(attr,this.attrListeners()[listeners]);
              }
            }
          }
          else
          {
            if(isStyle)
            {
              listeners = (update ? _styleUpdateListeners : _styleListeners);
              cut(attr,listeners);
            }
            else
            {
              if(attr === _all)
              {
                listeners = (update ? _styleUpdateListeners : _styleListeners);
                cut(attr,listeners);
              }
              listeners = (update ? _attrUpdateListeners : _attrListeners);
              cut(attr,listeners);
            }
          }
        }
321778
function onRemove(scope, element, opts) {
      opts.cleanupInteraction();
      opts.cleanupBackdrop();
      opts.cleanupResizing();
      opts.hideBackdrop();

      // Before the menu is closing remove the clickable class.
      element.removeClass('md-clickable');

      // For navigation $destroy events, do a quick, non-animated removal,
      // but for normal closes (from clicks, etc) animate the removal

      return (opts.$destroy === true) ? detachAndClean() : animateRemoval().then(detachAndClean);

      /**
       * For normal closes, animate the removal.
       * For forced closes (like $destroy events), skip the animations
       */
      function animateRemoval() {
        return $animateCss(element, {addClass: 'md-leave'}).start();
      }

      /**
       * Detach the element
       */
      function detachAndClean() {
        element.removeClass('md-active');
        detachElement(element, opts);
        opts.alreadyOpen = false;
      }

    }
211463
def remove(self, items):
        """"""
        items = coerce_to_list(items)
        new_options = {k: v for k, v in self.options.items() if v not in items}
        self.widget.options = new_options
        self.widget.param.trigger('options')
416385
function resetElements()
    {
        foreach ( $this->Functions as $functionName => $functionObject )
        {
            if ( is_object( $functionObject ) and
                 method_exists( $functionObject, 'resetFunction' ) )
            {
                $functionObject->resetFunction( $functionName );
            }
        }

        foreach ( $this->Operators as  $operatorName => $operatorObject )
        {
            if ( is_object( $operatorObject ) and
                 method_exists( $operatorObject, 'resetOperator' ) )
            {
                $operatorObject->resetOperator( $operatorName );
            }
        }
    }
36304
def add_function(self, func):
        
        try:
            # func_code does not exist in Python3
            code = func.__code__
        except AttributeError:
            warnings.warn("Could not extract a code object for the object %r"
                          % func)
        else:
            self.add_code(code)
561256
function insert(queue, index, fns, mode = InsertMode.REGULAR) {
  fns.forEach(({ fn, name }) => {
    if (queue.findIndex(e => e.name === name) !== -1) {
      throw new Error(`${name}: A function is already queued with this name`);
    } else if (typeof fn !== 'function') {
      throw new Error(`${name}: Not a valid function`);
    }
  });

  const deleteCount = mode === InsertMode.REPLACE ? 1 : 0;
  queue.splice(index, deleteCount, ...fns);
}
1318571
function Splice(object, index, removed, addedCount) {
    ChangeRecord.call(this, object, 'splice', String(index));
    this.index = index;
    this.removed = removed;
    this.addedCount = addedCount;
  }