shortcut to insert an element
166933
public static function create(array $columns_and_values=[]) {

		return Database::query()
			->insert($columns_and_values)
			->into(self::tableName())
			->execute();

	}
975760
function ($placeholder) {
			$.fn.mediumInsert.insert.deselect();


			var formHtml = '<div class="medium-editor-toolbar medium-editor-toolbar-active medium-editor-toolbar-form-anchor mediumInsert-embedsWire" style="display: block;"><input type="text" value="" placeholder="' + this.options.urlPlaceholder + '" class="mediumInsert-embedsText medium-editor-toolbar-anchor-input"></div>';
			$(formHtml).appendTo($placeholder.prev());
			setTimeout(function () {
				$placeholder.prev().find('input').focus();
			}, 50);

			$.fn.mediumInsert.insert.deselect();

			this.currentPlaceholder = $placeholder;
			$(".mediumInsert-embedsText").focus();
		}
595359
def insert_after(self, text):
        
        return Document(
                text=self.text + text,
                cursor_position=self.cursor_position,
                selection=self.selection)
227386
def insert(key, value)
      node = myself

      # Traverse the tree to find the right node to add or replace the value.
      while node do
        # All nodes that we find on the way that are full will be split into
        # two half-full nodes.
        if node.keys.size >= @tree.node_size
          node = node.split_node
        end

        # Once we have reached a leaf node we can insert or replace the value.
        if node.is_leaf?
          return node.insert_element(key, value)
        else
          # Descend into the right child node to add the value to.
          node = node.children[node.search_key_index(key)]
        end
      end

      PEROBS.log.fatal "Could not find proper node to insert into"
    end
780704
function insertAt(parent, index, html) {
  console.log('inserting at ' + index + ' ' + html);
  console.log(parent);
  if (index === 0)
    return parent.prepend(html);
  parent.children(':nth-child(' + index + ')').after(html);
}
1176261
function insertTextScript(text) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.text = text;
    insertHeaderNode(script);
    return script;
}
723172
function startTagInSelect(p, token) {
    var tn = token.tagName;

    if (tn === $.HTML)
        startTagInBody(p, token);

    else if (tn === $.OPTION) {
        if (p.openElements.currentTagName === $.OPTION)
            p._processFakeEndTag($.OPTION);

        p._insertElement(token, NS.HTML);
    }

    else if (tn === $.OPTGROUP) {
        if (p.openElements.currentTagName === $.OPTION)
            p._processFakeEndTag($.OPTION);

        if (p.openElements.currentTagName === $.OPTGROUP)
            p._processFakeEndTag($.OPTGROUP);

        p._insertElement(token, NS.HTML);
    }

    else if (tn === $.SELECT)
        p._processFakeEndTag($.SELECT);

    else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA) {
        if (p.openElements.hasInSelectScope($.SELECT)) {
            p._processFakeEndTag($.SELECT);
            p._processToken(token);
        }
    }

    else if (tn === $.SCRIPT || tn === $.TEMPLATE)
        startTagInHead(p, token);
}
38683
function insert_token(item) {
          var $this_token = $($(input).data("settings").tokenFormatter(item));
          var readonly = item.readonly === true ? true : false;

          if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);

          $this_token.addClass($(input).data("settings").classes.token).insertBefore(input_token);

          // The 'delete token' button
          if(!readonly) {
            $("<span>" + $(input).data("settings").deleteText + "</span>")
                .addClass($(input).data("settings").classes.tokenDelete)
                .appendTo($this_token)
                .click(function () {
                    if (!$(input).data("settings").disabled) {
                        delete_token($(this).parent());
                        hidden_input.change();
                        return false;
                    }
                });
          }

          // Store data on the token
          var token_data = item;
          $.data($this_token.get(0), "tokeninput", item);

          // Save this token for duplicate checking
          saved_tokens = saved_tokens.slice(0,selected_token_index).concat([token_data]).concat(saved_tokens.slice(selected_token_index));
          selected_token_index++;

          // Update the hidden input
          update_hidden_input(saved_tokens, hidden_input);

          token_count += 1;

          // Check the token limit
          if($(input).data("settings").tokenLimit !== null && token_count >= $(input).data("settings").tokenLimit) {
              input_box.hide();
              hide_dropdown();
          }

          return $this_token;
      }
413907
function (element) {
            var hiddenElement = _Global.document.createElement("div");
            hiddenElement.style[_BaseUtils._browserStyleEquivalents["animation-name"].scriptName] = "WinJS-node-inserted";
            hiddenElement.style[_BaseUtils._browserStyleEquivalents["animation-duration"].scriptName] = "0.01s";
            hiddenElement.style["position"] = "absolute";
            element.appendChild(hiddenElement);

            exports._addEventListener(hiddenElement, "animationStart", function (e) {
                if (e.animationName === "WinJS-node-inserted") {
                    var e = _Global.document.createEvent("Event");
                    e.initEvent("WinJSNodeInserted", false, true);
                    element.dispatchEvent(e);
                }
            }, false);

            return hiddenElement;
        }
82384
function insert( editable, type, data ) {
			var editor = editable.editor,
				selection = editor.getSelection(),
				// HTML insertion only considers the first range.
				// Note: getRanges will be overwritten for tests since we want to test
				// 		custom ranges and bypass native selections.
				// TODO what should we do with others? Remove?
				range = selection.getRanges()[ 0 ],
				dontFilter = false;

			if ( type == 'unfiltered_html' ) {
				type = 'html';
				dontFilter = true;
			}

			// Check range spans in non-editable.
			if ( range.checkReadOnly() )
				return;

			// RANGE PREPARATIONS

			var path = new CKEDITOR.dom.elementPath( range.startContainer, range.root ),
				// Let root be the nearest block that's impossible to be split
				// during html processing.
				blockLimit = path.blockLimit || range.root,
				// The "state" value.
				that = {
					type: type,
					dontFilter: dontFilter,
					editable: editable,
					editor: editor,
					range: range,
					blockLimit: blockLimit,
					// During pre-processing / preparations startContainer of affectedRange should be placed
					// in this element in which inserted or moved (in case when we merge blocks) content
					// could create situation that will need merging inline elements.
					// Examples:
					// <div><b>A</b>^B</div> + <b>C</b> => <div><b>A</b><b>C</b>B</div> - affected container is <div>.
					// <p><b>A[B</b></p><p><b>C]D</b></p> + E => <p><b>AE</b></p><p><b>D</b></p> =>
					//		<p><b>AE</b><b>D</b></p> - affected container is <p> (in text mode).
					mergeCandidates: [],
					zombies: []
				};

			prepareRangeToDataInsertion( that );

			// DATA PROCESSING

			// Select range and stop execution.
			// If data has been totally emptied after the filtering,
			// any insertion is pointless (#10339).
			if ( data && processDataForInsertion( that, data ) ) {
				// DATA INSERTION
				insertDataIntoRange( that );
			}

			// FINAL CLEANUP
			// Set final range position and clean up.

			cleanupAfterInsertion( that );

			// Make the final range selection.
			range.select();

			afterInsert( editable );
		}
978812
function _insertPoint(eventData, insertInfo) {
  const toolData = getToolState(eventData.element, this.name);

  if (toolData === undefined) {
    return;
  }

  // Get the toolData from insertInfo
  const data = toolData.data[insertInfo.toolIndex];

  const insertIndex = _getInsertionIndex(insertInfo);

  if (insertIndex === Infinity) {
    return;
  }

  const handleData = new FreehandHandleData(eventData.currentPoints.image);

  const points = data.handles.points;

  // Add the new handle
  points.splice(insertIndex, 0, handleData);

  // Add the line from the previous handle to the inserted handle (note the tool is now one increment longer)
  points[insertIndex - 1].lines.pop();
  points[insertIndex - 1].lines.push(eventData.currentPoints.image);

  addLine(points, insertIndex);

  data.active = true;
  data.highlight = true;

  // Force onImageRendered to fire
  data.invalidated = true;
  external.cornerstone.updateImage(eventData.element);
}
662955
def _insert_item(self, root, data, from_file=False):
        """"""

        tree = self.treeview
        treelabel = data.get_id()
        row = col = ''
        if root != '' and 'layout' in data:
            row = data.get_layout_property('row')
            col = data.get_layout_property('column')

            # fix row position when using copy and paste
            # If collision, increase by 1
            row_count = self.get_max_row(root)
            if not from_file and (row_count > int(row) and int(col) == 0):
                row = str(row_count + 1)
                data.set_layout_property('row', row)

        image = ''
        try:
            image = StockImage.get('16x16-tk.default')
        except StockImageException:
            # TODO: notify something here
            pass

        try:
            image = StockImage.get('16x16-{0}'.format(data.get_class()))
        except StockImageException:
            # TODO: notify something here
            pass

        values = (data.get_class(), row, col)
        item = tree.insert(root, 'end', text=treelabel, values=values,
                           image=image)
        data.attach(self)
        self.treedata[item] = data

        # Update grid r/c data
        self._update_max_grid_rc(root, from_file=True)
        self.app.set_changed()

        return item
378802
function () {
			var that = this,
					$el = $.fn.mediumInsert.insert.$el;

			$el.on('selectstart mousedown', '.mediumInsert', function (e) {
				if ($(e.target).is('img') === false) {
					e.preventDefault();
				}
			});

			$el.on('blur', function () {
				var $clone = $(this).clone(),
						cloneHtml;

				$clone.find('.mediumInsert').remove();
				cloneHtml = $clone.html().replace(/^\s+|\s+$/g, '');

				if (cloneHtml === '' || cloneHtml === '<p><br></p>') {
					$(this).addClass('medium-editor-placeholder');
				}
			});


			// Fix #29
			// Sometimes in Firefox when you hit enter, <br type="_moz"> appears instead of <p><br></p>
			// If it happens, force to wrap the <br> into a paragraph
			$el.on('keypress', function (e) {
				if (that.isFirefox) {
					if (e.keyCode === 13) {
						//wrap content text in p to avoid firefox problems
						$el.contents().each((function() {
							return function(index, field) {
								if (field.nodeName === '#text' && field.textContent.trim() !== '') {
									document.execCommand('insertHTML', false, "<p>" + field.data + "</p>");
									return field.remove();
								}
							};
						})(this));
						// Removed because of #94 issue
						//
						// Firefox add extra br tag inside p tag
						// var latestPTag = $el.find('p').last();
						// if (latestPTag.text().length > 0) {
						//   latestPTag.find('br').remove();
						// }
					}
				}
			});

			// Fix #39
			// For some reason Chrome doesn't "select-all", when the last placeholder is visible.
			// So it's needed to hide it when the user "selects all", and show it again when they presses any other key.
			$el.on('keydown', function (e) {
				// Fix Select-all using (ctrl + a) in chrome
				if (navigator.userAgent.match(/chrome/i)) {
					$el.children().last().removeClass('hide');
					if ( (e.ctrlKey || e.metaKey) && e.which === 65) {
						e.preventDefault();
						if($el.find('p').text().trim().length === 0) {
							return false;
						}

						$el.children().last().addClass('hide');
						return document.execCommand('selectAll', false, null);
					}
				}
			});

			$el.on('click', '.mediumInsert-buttons a.mediumInsert-buttonsShow', function () {
				var $options = $(this).siblings('.mediumInsert-buttonsOptions'),
						$placeholder = $(this).parent().siblings('.mediumInsert-placeholder');

				if ($(this).hasClass('active')) {
					$(this).removeClass('active');
					$options.hide();

					$('a', $options).show();
				} else {
					$(this).addClass('active');
					$options.show();

					$('a', $options).each(function () {
						var aClass = $(this).attr('class').split('action-')[1],
								plugin = aClass.split('-')[0];
						if ($('.mediumInsert-'+ plugin, $placeholder).length > 0) {
							$('a:not(.action-'+ aClass +')', $options).hide();
						}
					});
				}

				that.deselect();
			});

			$el.on('mouseleave', '.mediumInsert', function () {
				$('a.mediumInsert-buttonsShow', this).removeClass('active');
				$('.mediumInsert-buttonsOptions', this).hide();
			});

			$el.on('click', '.mediumInsert-buttons .mediumInsert-action', function (e) {
				e.preventDefault();

				var addon = $(this).data('addon'),
						action = $(this).data('action'),
						$placeholder = $(this).parents('.mediumInsert-buttons').siblings('.mediumInsert-placeholder');

				if (addons[addon] && addons[addon][action]) {
					addons[addon][action]($placeholder);
				}

				$(this).parents('.mediumInsert').mouseleave();
			});
		}
276680
function append() {
  var i, l = this.length, el, args = this.slice.call(arguments);
  function it(node, index) {
    // content elements to insert
    el.each(function(ins) {
      ins = (index < (l - 1)) ? ins.cloneNode(true) : ins;
      node.appendChild(ins);
    });
  }
  for(i = 0;i < args.length;i++) {
    // wrap content
    el = this.air(args[i]);
    // matched parent elements (targets)
    this.each(it);
  }
  return this;
}
1176814
function () {
            var me = this, shortcutkeys = this.shortcutkeys;
            me.addListener('keydown', function (type, e) {
                var keyCode = e.keyCode || e.which;
                for (var i in shortcutkeys) {
                    var tmp = shortcutkeys[i].split(',');
                    for (var t = 0, ti; ti = tmp[t++];) {
                        ti = ti.split(':');
                        var key = ti[0], param = ti[1];
                        if (/^(ctrl)(\+shift)?\+(\d+)$/.test(key.toLowerCase()) || /^(\d+)$/.test(key)) {
                            if (( (RegExp.$1 == 'ctrl' ? (e.ctrlKey || e.metaKey) : 0)
                                && (RegExp.$2 != "" ? e[RegExp.$2.slice(1) + "Key"] : 1)
                                && keyCode == RegExp.$3
                                ) ||
                                keyCode == RegExp.$1
                                ) {
                                if (me.queryCommandState(i,param) != -1)
                                    me.execCommand(i, param);
                                domUtils.preventDefault(e);
                            }
                        }
                    }

                }
            });
        }
989680
function insertAfter(targetElement, targetScope) {
            // Ensure the placeholder is visible in the target (unless it's a table row)
            if (placeHolder.css('display') !== 'table-row') {
              placeHolder.css('display', 'block');
            }
            if (!targetScope.sortableScope.options.clone) {
              targetElement.after(placeHolder);
              dragItemInfo.moveTo(targetScope.sortableScope, targetScope.index() + 1);
            }
          }
1118778
def insert(self, i, x):
        """"""
        if i == len(self):  # end of list or empty list: append
            self.append(x)
        elif len(self.matches) > i:
            # create a new xml node at the requested position
            insert_index = self.matches[i].getparent().index(self.matches[i])
            _create_xml_node(self.xast, self.node, self.context, insert_index)
            # then use default set logic
            self[i] = x
        else:
            raise IndexError("Can't insert '%s' at index %d - list length is only %d" \
                            % (x, i, len(self)))