Skip to content

Instantly share code, notes, and snippets.

@robertvrabel
robertvrabel / list.html
Last active February 27, 2022 15:46
Updating a database display order with drag and drop in SQL
<table>
<thead>
<tr>
<th scope="col">user_id</th>
<th scope="col">display_order</th>
<th scope="col">todo</th>
</tr>
</thead>
<tbody>
<tr>
@robertvrabel
robertvrabel / gist:786e84b9703e9a948a1a2b0b16893b3f
Created January 25, 2017 19:58
Sort profile users by group
<?php
/**
* Profile users are in multiple groups.
*
* The expected $sortedArray should be grouped by group_id (which is the key) to array of users who are in that group.
*
* The only groups that should be in $sortedArray should be ones that exist in $statuses.
*/