Skip to content

Instantly share code, notes, and snippets.

View rohjay's full-sized avatar
👍
Doing alright... How are you? =]

Ryan Oeltjenbruns rohjay

👍
Doing alright... How are you? =]
View GitHub Profile
@rohjay
rohjay / grouper.php
Last active March 13, 2016 21:11
php function to group a list of dictionaries by a common key.
<?php
// I find myself grouping a lot of data... heres a quick helper function to do just that =]
function grouper($data, $key_to_group_by, $key_to_group_unfound='unfound', $unset_key_from_data=false) {
$grouped_results = array();
foreach ( $data as $k => $value ) {
$value_key = isset($value[$key_to_group_by]) ? $value[$key_to_group_by] : $key_to_group_unfound;
if ( !isset($grouped_results[$value_key]) ) {
$grouped_results[$value_key] = array();
@rohjay
rohjay / hasheesh.php
Last active March 27, 2019 17:58
Class to get the strongest hashing algorigthm available on any system to salt and hash passwords. Hasheesh =]
<?php
class Hasheesh
{
public static $algo = False;
public static function init()
{
$algos = array();
foreach ( hash_algos() as $algo ) {