Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Floering hangtwenty

View GitHub Profile
@hangtwenty
hangtwenty / how to change the text editor for code and text files on mac.md
Last active Jan 10, 2021
how to change the text editor that iterm2 opens when you ⌘+click on a filename, etc
View how to change the text editor for code and text files on mac.md

Well, I decided to just change my Mac's default text editor. It was the path of least resistance. I use VS Code and JetBrains mostly, but I want to open MacVim when I cmd+click a filename in a stacktrace.

First install duti.

brew install duti

To change the default text editor to MacVim

@hangtwenty
hangtwenty / meteor yarn - how to use yarn instead of npm with meteor.md
Last active Jan 8, 2021
meteor + yarn - how to use yarn instead of npm with meteor
View meteor yarn - how to use yarn instead of npm with meteor.md
@hangtwenty
hangtwenty / HOWTO_install_xmobar_with_all_extensions.sh
Last active Dec 26, 2020
HOWTO xmobar with all extensions in Arch Linux
View HOWTO_install_xmobar_with_all_extensions.sh
#!/bin/sh
# install cabal-install if necessary
sudo pacman -S cabal-install
# preparing to install xmobar with all extensions
sudo pacman -S alex
yaourt haskell-language-c-03
sudo cabal install --global c2hs
sudo cabal install --global alsa-mixer
@hangtwenty
hangtwenty / absolute_path_to_script_directory.sh
Created Dec 7, 2020
bash/zsh script - how to get absolute path to itself
View absolute_path_to_script_directory.sh
export HERE="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
# example usage - source a script in same directory. but using absolute path,
# ... which you'd do so that a script can be called from wherever. (not dependent on working directory ($PWD))
. "${HERE}/common.sh"
# ... or of course you could export DIRNAME or whatever you want.
# In scripts I just find "$HERE/node_modules", "$HERE/src" etc to be pretty readable.
@hangtwenty
hangtwenty / jetbrains_toolbox_app_paths.md
Created Dec 1, 2020
JetBrains toolbox: Where are the IDEs located on my hard drive?
View jetbrains_toolbox_app_paths.md

The default locations depend on your operating system:

macOS: 
  ~/Library/Application Support/JetBrains/Toolbox/apps
  
Linux: 
  ~/.local/share/JetBrains/Toolbox/apps

Windows: 
  %LOCALAPPDATA%\JetBrains\Toolbox\apps
View elderjs-shortcode-motivation.md

why you may need to customize shortcode syntax

  • elder.js self closing shortcodes look like this: {{foo bar="true"/}}. Note the / at the end is for Elder.js to parse both self closing and content wrapping shortcodes.
  • this clashes with other shortcode systems, eg. dev.to, which uses shortcodes that look like this: {% youtube abc123 %}
  • in elder.config.js you can customize the start and end shortcode: {%foo bar="true"/%}
  • however that / there is non negotiable.
  • this is why you need to customize the shortcode syntax

the strategy is, if you use remark to process the text, to write a custom remark plugin to replace specifically this %} ending code of the dev.to shortcode to what Elder.js expects

@hangtwenty
hangtwenty / tupperware.py
Last active Sep 24, 2020
recursively convert nested dicts to nested namedtuples, giving you something like immutable object literals
View tupperware.py
from UserDict import IterableUserDict
import collections
__author__ = 'github.com/hangtwenty'
def tupperware(mapping):
""" Convert mappings to 'tupperwares' recursively.
@hangtwenty
hangtwenty / continuous_learning_inflection_point.md
Last active Aug 17, 2020
blog draft: continuous learning is the keystone habit of software development. oh, and the other part: you have to get over yourself!
View continuous_learning_inflection_point.md

I've self-educated as a developer; now almost 10 years into it, it's worked out for me. But why? What was the deciding factor?

Looking back, I think I can see the inflection point.

I had a mentor who helped me use interactive approaches, and test-driven development. This led to a test-driven mindset.

The core of this mindset is the empirical attitude: that you can know nothing without testing. I learned to iterate in a more directed way. And by always beginning with failing tests,

@hangtwenty
hangtwenty / myweechat.md
Created May 12, 2020 — forked from pascalpoitras/myweechat.md
My always up-to-date WeeChat configuration (weechat-dev)
View myweechat.md

WeeChat Screenshot

You need at least WeeChat 2.8-dev

Enable mouse

/mouse enable
You can’t perform that action at this time.