"" | |
" Return project's root directory | |
" | |
" This function is used to return current projects root directory, as | |
" determined by GIT or SVN, without changing vim's cwd. | |
" | |
" @param string a:1 A comma seperated list of files or directories, the | |
" presence of which can be used to identify the root directory of a project. | |
" | |
function! UmkaDK#GetProjectRoot(...) |
I've been maintaining my own version of Strip Trailing Spaces function (attached at the bottom of this post) since I first started using vim. It grew out of a simple :%s/\s*$//
and now includes a number of features:
- it preserves search history and the last search string
- it doesn't change editor's
''
,'.
and'^
marks - it doesn't add a new jumplist and changelist record
- it preserves editor's view and cursor position
However, over the years I've noticed that I never needed to undo the results of stripping trailing spaces from a file. In fact, I would go as far as to say that when undoing changes in a file, the function produces an understandable but somewhat undesirable cursor jump (to the top-most trailing space it strippes) which disrupts my work flow. So, I set about to exclude the results of this function from the undo history all together.
After reading [Restore the cursor position after undoing text change made by a script](http://vim.wikia.com/wiki/Restore_the_cursor_position_aft
/** | |
* MusicBrainz (http://musicbrainz.org) comes with a custom unaccent pgsql extension (musicbrainz_unaccent). | |
* However, AWS PGSQL service does not include this extension and it can not be easilly added. | |
* | |
* The following code duplicates musicbrainz_unaccent functionality using the built in unaccent extension. | |
*/ | |
CREATE EXTENSION unaccent; | |
CREATE OR REPLACE FUNCTION musicbrainz_unaccent(txt text) RETURNS text AS $$ | |
BEGIN |
#!/usr/bin/env bash | |
echo "Removing unused containers ..." | |
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v | |
echo | |
echo "Removing unused images ..." | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi | |
echo |
I find that every now and again VirtualBox glitches out and fails to install (or update) on macOS. This has happened to me a few times now, and every single time it's because Apple security policies prevent VirtualBox kernel extensions from being loaded.
Attempt 1 of 2: Start with OSXDaily fix: check your "System Preferences > Security & Privacy > General". There might be a discreet note in the lower part of the window saying that kernel extensions from the developer Oracle could not be loaded and an option to whitelist them by clicking on the "Allow" button. Done! :)
#!/usr/bin/env bash | |
# | |
# Remove Project Environment artefacts from a Github project: This script | |
# can be used to remove all "environment" artefacts from a project that, | |
# for example, no longer uses github-pages. Doing so would also remove the | |
# "environment" tab from the Github repository. | |
# | |
# The script requires for `curl` and `jq` to be in your PATH. You will also | |
# need to define a personal access token with `repo_deployment` scope on | |
# Github, and update the values of API_URL_BASE and ACCESS_TOKEN bellow. |
Caching Docker builds in GitHub Actions is an excellent article by @dtinth which analyses various strategies for speeding up builds in GitHub Actions. The upshot of the article is a fairly decisive conclusion that the best two ways to improve build times are:
-
Build images via a standard
docker build
command, while using GitHub Packages' Docker registry as a cache = Longer initial build but fastest re-build times. -
Build your images via docker integrated BuildKit (
DOCKER_BUILDKIT=1 docker build
), while using a local registry and actions/cache to persist build caches = Fastest initial build but slightly longer re-build times.
- Beta version of iTerm2 has built-in support for system appearance and will change themes in sync with macOS;
- Setup dark-mode-notify to launch on start and call a custom shell script (eg: appearance-change.sh) when appearance changes;
- Update the script as required
NOTE:
- neovim v0.8.0+ can issue self referencing commands. For example, try putting this into your
init.lua
to prevent nested vim instances when using built-in terminal:vim.env.EDITOR = string.format('nvim --server %s --remote --', vim.api.nvim_get_vvar('servername'))