Skip to content

Instantly share code, notes, and snippets.

View benrogmans's full-sized avatar

Ben Rogmans benrogmans

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1Q9Jj4LPxm7j7Ey6fLep1cqMtgaXkTo4hx https://explorer.blockstack.org/address/1Q9Jj4LPxm7j7Ey6fLep1cqMtgaXkTo4hx
Verifying my Blockstack ID is secured with the address 1CwN73jmTTWMAM3VbyjjYzyKVfWdJCaufn https://explorer.blockstack.org/address/1CwN73jmTTWMAM3VbyjjYzyKVfWdJCaufn
Verifying my Blockstack ID is secured with the address 1CwN73jmTTWMAM3VbyjjYzyKVfWdJCaufn https://explorer.blockstack.org/address/1CwN73jmTTWMAM3VbyjjYzyKVfWdJCaufn
0xfd19d98f55dB006DEB66A62746a8a08ef418c219
@benrogmans
benrogmans / ProcessWireValetDriver
Created May 22, 2017 09:16
Using Valet for ProcessWire sites
<?php
class ProcessWireValetDriver extends BasicValetDriver
{
private $possibleDirectories = [
'', // PW in root, do not remove except you're sure you never use it
'/dist',
'/public'
];
@benrogmans
benrogmans / async_loop
Created March 9, 2015 09:48
Asynchronous loop
function async_loop($array, $function) {
foreach($array as $key => $item) {
$pid = pcntl_fork();
if ($pid) {
$childs[] = $pid;
} else {
$function($key, $item);
exit();
}
@benrogmans
benrogmans / gist:e0f47ce076e570ebe0b2
Created October 3, 2014 07:40
Bash autocomplete ssh hosts
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@benrogmans
benrogmans / gist:e4e66eced716d08183da
Created August 21, 2014 12:01
PyroCMS query to find unused fields
SELECT * FROM
default_data_fields
LEFT JOIN
default_data_field_assignments
ON
default_data_fields
.id =
default_data_field_assignments
.field_id WHERE
default_data_field_assignments
sudo chmod -R 777 system/cms/cache && sudo chmod -R 777 system/cms/config && sudo chmod -R 777 addons && sudo chmod -R 777 assets/cache && sudo chmod -R 777 uploads && sudo chmod -R 666 system/cms/config/config.php
@benrogmans
benrogmans / Sort multidimensional array by value php
Last active August 29, 2015 13:58
Sort multidimensional array by value php function
function sort_array($array, $columns) {
usort($array, function($a, $b) use ($columns) {
$t = array(true => -1, false => 1);
$r = true;
$k = 1;
foreach ($columns as $order => $value) {
$k = (strtolower($order) === 'desc') ? -1 : 1;