Skip to content

Instantly share code, notes, and snippets.

View davidsierradz's full-sized avatar
🇨🇴
OSS <3

David Sierra DiazGranados davidsierradz

🇨🇴
OSS <3
View GitHub Profile
@InternetUnexplorer
InternetUnexplorer / command-not-found.sh
Last active March 17, 2024 11:53
Improved home-manager nix-locate configuration, with an auto-updated index and a better command-not-found handler
# Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh
command_not_found_handle () {
if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then
>&2 echo "$1: command not found"
return 127
fi
echo -n "searching nix-index..."
ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1")
@BuonOmo
BuonOmo / time_ago.sh
Last active July 7, 2023 12:42
Time ago in words within bash
#!/usr/bin/env bash
# Copyright (c) 2019 Ulysse Buonomo <buonomo.ulysse@gmail.com> (MIT license)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@danmikita
danmikita / init.vim
Created November 16, 2018 19:16
File preview with FZF, RG, Bat, and Devicons
nnoremap <silent> <leader>e :call Fzf_dev()<CR>
" ripgrep
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --hidden --follow --glob "!.git/*"'
set grepprg=rg\ --vimgrep
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
endif
" Files + devicons
@haringsrob
haringsrob / init.nvim
Created November 4, 2018 16:58
VIM config for PHP/Drupal editing
" Leader key <SPACE>
let mapleader=" "
nnoremap <Space> <Nop>
call plug#begin('~/.config/nvim/plugged')
Plug 'phpactor/phpactor' , {'do': 'composer install', 'for': 'php'}
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'phpactor/ncm2-phpactor'
Plug 'ncm2/ncm2-ultisnips'
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active July 23, 2024 00:25
set -e, -u, -o, -x pipefail explanation
@olmokramer
olmokramer / config.py
Created September 6, 2018 22:53
Qutebrowser per-domain stylesheets
c.content.user_stylesheets = ['/path/to/reddit.user.css']
# or if you have a directory with .user.css files:
import glob
c.content.user_stylesheets = glob.glob('/path/to/*.user.css')
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active June 13, 2024 09:52
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@mrkwatz
mrkwatz / Firefox_Scrollbars-W10style.md
Last active July 25, 2024 19:50
Firefox 57 Windows 10 UWP Style Overlay Scrollbars

As far as I am aware the time has come and as of Firefox 72 XUL has been stripped from firefox and so the method used to inject this scrollbar theme is no longer supported -- reference the following for future scroll themes:

Mozilla is currently working to phase out the APIs used to make this theme work. I will try to maintain each version until that time but eventually there will be no workaround. When that time comes there is a new, but more limited api for applying simple themes to scrollbars. In nightly I am currently using the following userContent.css

:root{
	scrollbar-width: thin;
	scrollbar-color: rgb(82, 82, 82) rgb(31, 31, 31);
}
@igemnace
igemnace / fzf-snippets.sh
Last active April 11, 2023 23:29
Some fzf snippets
fzf_argfiles() {
fzf --multi | tr '\n' ' '
}
# for unstaged changes and untracked files
fzf_dirty_files() {
git status --porcelain | cut -c 1,2,3 --complement | fzf --multi --preview-window=up:50% --preview='git diff --color=always {}'
}
fzf_modified_files() {
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨