Sorts the elements according to the array.
@param  {String[]}  order  order of the items
482764
function (order) {
			var items = {}, rootEl = this.el;

			this.toArray().forEach(function (id, i) {
				var el = rootEl.children[i];

				if (_closest(el, this.options.draggable, rootEl)) {
					items[id] = el;
				}
			}, this);

			order.forEach(function (id) {
				if (items[id]) {
					rootEl.removeChild(items[id]);
					rootEl.appendChild(items[id]);
				}
			});
		}
580754
function massageSort(sort) {
  if (!Array.isArray(sort)) {
    throw new Error('invalid sort json - should be an array');
  }
  return sort.map(function (sorting) {
    if (typeof sorting === 'string') {
      var obj = {};
      obj[sorting] = 'asc';
      return obj;
    } else {
      return sorting;
    }
  });
}
1282819
public function sortPrimaryKeys(array $order = null)
    {
        if (!$order) {
            ksort($this->values);

            return;
        }

        $orderedKeys = array_intersect_key(array_flip($order), $this->values);

        $this->values = array_replace($orderedKeys, $this->values);
    }
1166576
public static <E extends Comparable<E>> void sort(E[] array) {
        while(!Sort.isSorted(array)) {
            FYShuffle.shuffle(array);
        }
    }
195967
public static <T> OrderBy<T> convertToEbeanOrderBy(Sort sort) {
        if (sort == null) {
            return null;
        }
        List<String> list = new ArrayList<>();

        Iterator<Sort.Order> orderIterator = sort.iterator();
        while (orderIterator.hasNext()) {
            Sort.Order so = orderIterator.next();
            list.add(so.getProperty() + " " + so.getDirection());
        }
        return new OrderBy<T>(StringUtils.collectionToCommaDelimitedString(list));
    }
924891
public static void sortDescending(float[] floatArray) {
        int index = 0;
        float value = 0;
        
        for(int i = 1; i < floatArray.length; i++) {
            index = i;
            value = floatArray[index];
            
            while(index > 0 && value > floatArray[index - 1]) {
                floatArray[index] = floatArray[index - 1];
                
                index--;
            }
            
            floatArray[index] = value;
        }
    }
723690
function orderNodes(ast) {
  var comments  = Array.isArray(ast.comments) ? ast.comments.slice() : [];
  var comparitor = ('sortIndex' in ast) ? compareIndex : compareLocation;
  return comments
    .concat(depthFirst(ast, ast.parent))
    .sort(comparitor)
    .map(setSortIndex);
}
606109
private void sort(final T[] array, int start, int end, Comparator<T> lt) {
    if (start == end)
      return;
    if ((end - start) <= 15)
      this.selectionSort(array, start, end, lt);
    else {
      final T pivot = array[start + ((end - start) / 2)];
      T tmp;
      int i = start - 1;
      int j = end;
      while (true) {
        do
          i++;
        while (lt.compare(array[i], pivot) < 0);
        do
          j--;
        while (lt.compare(pivot, array[j]) < 0);
        if (i >= j)
          break;
        tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
      }
      this.sort(array, start, i, lt);
      this.sort(array, i, end, lt);
    }
  }
222512
private function sort($items, $order)
    {
        uasort($items, function (Item $item1, Item $item2) use ($order) {
            return ($item1->getValue() < $item2->getValue()) ? (-1 * $order) : $order;
        });

        return $items;
    }
439121
function order($order)
	{
		$parsed_order = array();
		foreach(explode(',', $order) as $property_name)
		{
			$property_name = trim($property_name);
			if(preg_match('/^-(.+)/', $property_name, $m))
			{
				$property_name = $m[1];
				$dir = ' DESC';
			}
			else
				$dir = '';

			$property_name = $this->first_parse($property_name);
			$property_name = $this->stack_parse($property_name);
			$property_name = $this->class_parse($property_name);

			$parsed_order[] = "$property_name$dir";
		}

		$this->_where['*raw_order'] = "ORDER BY ".join(', ', $parsed_order);

		return $this;
	}
100196
public static <E extends Comparable<E>> void sort(E[] intArray) {
        Merge.sort(intArray, 0, intArray.length-1, false);
    }
1277601
def sort(self, order="asc"):
        
        self.__prepare()
        if isinstance(self._json_data, list):
            if order == "asc":
                self._json_data = sorted(self._json_data)
            else:
                self._json_data = sorted(self._json_data, reverse=True)

        return self
1059348
function SortOrderComparator(sortOrder, options) {
        this.sortOrder = sortOrder;
        this.options = {
            casesensitive: false
        };
        if (options) {
            _.extend(this.options, options);
        }
        this.expressions = new Array(sortOrder.sortFields.length);
        for (var i = 0; i < this.expressions.length; ++i) {
            this.expressions[i] = new JsonPath_1.JsonPath(sortOrder.sortFields[i].name);
        }
    }
831246
public function prepareOrder($order = null, $sort = null)
    {
        if ($order == null or $sort == null) {
            $this->setOrderBy = '';

            return $this;
        }

        if (!in_array($sort, ['ASC', 'DESC'])) {
            $sort = 'DESC';
        }

        $this->setOrderBy = ' ORDER BY ' . $order . ' ' . $sort;

        return $this;
    }
588364
function sortBy(array, attr) {
  assert(Array.isArray(array));
  return array.sort(function(a,b) {
    a = a[attr];
    b = b[attr];
    return (a < b) ? -1 : ((a > b) ? 1 : 0);
  });
}
1247363
protected function sort(array &$files, $sort, $order)
    {
        $sorters = $this->getSorters();

        if (isset($sorters[$sort]['handlers']['sort'])) {
            $function = $sorters[$sort]['handlers']['sort'];
            // Suppress errors, see https://bugs.php.net/bug.php?id=50688
            @uasort($files, function ($a, $b) use ($function, $order) {
                return $function($a, $b, $order);
            });
        }
    }
750634
public function addOrderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
    }