Skip to content

Instantly share code, notes, and snippets.

View frehder's full-sized avatar

Florian Rehder frehder

View GitHub Profile
@frehder
frehder / git.md
Created January 26, 2022 09:32
[Get changes from other Branch without committing] Cherry-pick without committing changes #git

To cherry pick one or more changes from another branch without creating a new commit(s) in your current branch.

  1. Get the from the changes commit.

  2. Cherry pick using:

$ git cherry-pick -n <hash>

Where -n is --no-commit.

@frehder
frehder / index.php
Created January 25, 2022 10:34
[Create a nested array from flat array] Flat array of values transforms to a nested array of keys. Used for a usenet hierarchy like tree listing #php
<?php
function create_tag_tree(array $keys = [], array $accu = [], int $count = 0): array {
if (count($keys) === 0 || $count > 100) return $accu;
$self = __FUNCTION__;
$key = array_pop($keys);
return $self($keys, [$key => $accu], $count+1);
}
@frehder
frehder / 1password-documents.bash
Last active February 10, 2021 14:49
Get 1Password document items from list with "op" CLI tool
#!/bin/bash
# jq json tool by https://stedolan.github.io/jq/
# install: $ brew install jq
echo 'Using jq json tool:'
which jq
# 1password login
eval $(op signin $NAME)