Skip to content

Instantly share code, notes, and snippets. Ugotsta

View GitHub Profile
Ugotsta / code-to-kbd.js
Last active Mar 13, 2019
JavaScript to automatically convert keypress shortcuts in isolated code elements like <code>Enter</code> to kbd elements like <kbd>Enter</kbd>.
View code-to-kbd.js
let code = document.querySelectorAll("code");
code.forEach( el => el.classList.add("prettyprint") );
code.forEach( i => {
let found = false;
let h = i.innerHTML.toLowerCase();
let c = ['tab', 'esc', 'return', 'enter'];
if ( c.includes(h) ) found = true;
if ( h.length === 1 ) found = true;
c = ['ctrl', 'alt', 'cmd', 'shift', 'win', 'super', 'kbd'];
Ugotsta / config
Created Feb 4, 2019
NCMPCPP basic config file with slight edits, core from here:
View config
# Files
mpd_music_dir = "~/Music"
lyrics_directory = ~/.ncmpcpp/lyrics
ncmpcpp_directory = ~/.ncmpcpp
mpd_host = "localhost"
mpd_port = "6600"
mpd_connection_timeout = "5"
mpd_crossfade_time = "5"
Ugotsta / light-only.css
Last active Oct 3, 2018
CSS selector to target light syntax themes in Atom editor. Used here:
View light-only.css
// should result in blue editor background if a theme with keyword "dark" is used
atom-workspace[class*="-light"] atom-text-editor {
background-color: blue !important;
View hyper-green-scanlines.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
Ugotsta / atom-subtle-shadows.css
Last active Sep 10, 2018
Subtle text shadow and complimentary background CSS for use in styles.less of Atom config section. Meant solely for light themes. These styles are designed to override some base syntax theme styles but in a way that should entail nice results across themes.
View atom-subtle-shadows.css
// body /deep/ atom-text-editor {
// transform: perspective(200px) rotateX(2deg) rotateZ(-3deg);
// transform-origin: center;
// transform-style: preserve-3d;
// }
atom-text-editor {
background: rgba(255,255,255,0.45);
inset 0px 0px 200px rgba(0,50,150,0.5);
Ugotsta /
Created Aug 30, 2018
Custom prompt for fish shell. Place in ~/.config/fish/functions
function fish_prompt
and set retc normal
or set retc red
tty | string match -q -r tty
and set tty tty
or set tty pts
set_color $retc
if [ $tty = tty ]
echo -n .-
Ugotsta /
Last active Aug 25, 2018
Installer script for Kitty terminal on elementary OS, or Ubuntu derivatives in general
#!/usr/bin/env bash
# ensure freetype is updated, important to avoid error:
# undefined symbol: FT_Get_Var_Blend_Coordinates
sudo add-apt-repository ppa:glasen/freetype2
sudo apt update && sudo apt install freetype2-demos
# kitty installer script from
curl -L | sh /dev/stdin
Ugotsta / subtle.kak
Created Aug 22, 2018
Dark color scheme for Kakoune with mostly subtle, legible editor colors and vibrant menus that stand out.
View subtle.kak
# code
face global value rgb:ffffff,default
face global type rgb:dedede,default
face global identifier rgb:dedede,default
face global string rgb:aaccaa,default
face global error default,rgb:ffffff
face global keyword rgb:bbbbbb,default+b
face global operator rgb:dedede,default
face global attribute rgb:ccaaaa,default
Ugotsta /
Last active Feb 12, 2019
Convert all occurrences of snake_case to camelCase in VS Code. Windows/Linux walk-through here:

Convert snake_case to camelCase in VS Code

  • Press CTRL-H ( ⌥⌘F on Mac ).
  • Press ALT-R ( ⌥⌘R on Mac ).
  • Type _([a-zA-Z]).
  • Press TAB and type $1.
  • Press ALT-ENTER ( ⌥ENTER on Mac ).
  • Press F1 and type upper, then press ENTER.
  • Press CTRL-ALT-ENTER ( ⌥ENTER on Mac ).

Convert snake_case to camelCase in Vim

Vim replace operation to convert snake_case to camelCase (credits @Sean C.): %s/_\([a-zA-Z]\)/\u\1/g

What's it for?

Automatically refactor a script's symbol names from snake_case to camelCase.

How to use it?

You can’t perform that action at this time.