Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*
@dr0bz
dr0bz / rg_grep.vim
Last active June 2, 2023 12:02
Vim grep wrapper for ripgrep (rg). Features: quickfix window match highlighting, regex, path and rg arguments.
" :Grep "Peding Transaction" " with fixed strings
" :Grep! "\sTransaction" " regex
" :Grep \$stateParam
" :Grep "Pending Transaction" -g "*.php" " with rg parameters
" :Grep "Pending Transaction" vendor/ " with path
" :Grep "Pending Transaction" -g "*.php" vendor " with rg parameters and path
" rg as :grep
set grepprg=rg\ --vimgrep\ --follow\ --hidden
set grepformat^=%f:%l:%c:%m
@dr0bz
dr0bz / waybar-monitor-hotplug.sh
Last active April 12, 2024 07:49
Hyprland waybar switch by monitor hotpluging
#!/bin/bash
#
# This script is for people like me running a laptop with external monitor and using the
# external monitor as the main output. As main output I want to have the waybar show up
# on it. With this script you get waybar on external monitor and when you unplug it - it
# will automatically change the display to Your display and vice versa.
#
# just put the following into your hyprland.conf:
# exec-once = waybar
# exec-once = ~/.config/hypr/scripts/waybar-monitor-switch.sh
@dr0bz
dr0bz / hamster.sh
Last active April 19, 2024 10:36
Waybar hamster module (custom/hamster) https://github.com/projecthamster/hamster
#!/bin/bash
activity=`hamster current`
if [[ $activity == "No activity" ]]; then
text=""
class=""
else
start_date=`echo $activity | cut -d' ' -f1`
start_time=`echo $activity | cut -d' ' -f2`
name=`echo $activity | sed 's/[0-9\-]\+\s[0-9\:]\+[[:space:]]\([[:alnum:] @-]\+\)[[:space:]][0-9\:]\+/\1/'`