Skip to content

Instantly share code, notes, and snippets.

@advitum
advitum / drag-and-drop-sortable-tables.markdown
Last active August 29, 2015 14:04
Sorting tables with drag and drop

Sorting tables with drag and drop

We start with a simple HTML table:

<table class="sortable">
	<tbody>
		<tr data-id="1">
			<td>Some content</td>
@advitum
advitum / humanFileSize.php
Created July 17, 2014 12:59
Makes file size human-readable
<?php
function humanFileSize($size, $german = true) {
$fileSizePrefixes = array('k', 'M', 'G', 'T', 'P');
$size = intval($size);
$prefix = -1;
while($size > 1024 / 5 && $prefix < count($fileSizePrefixes) - 1) {
$size /= 1024;