Skip to content

Instantly share code, notes, and snippets.

go.ugotsta.com Ugotsta

View GitHub Profile
@Ugotsta
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
Ugotsta / config
Created Feb 4, 2019
NCMPCPP basic config file with slight edits, core from here: https://computingforgeeks.com/how-to-configure-mpd-and-ncmpcpp-on-linux/
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
Ugotsta / light-only.css
Last active Oct 3, 2018
CSS selector to target light syntax themes in Atom editor. Used here: https://atom.io/themes/cityscape-ui
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 https://hyper.is#cfg 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
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);
box-shadow:
inset 0px 0px 200px rgba(0,50,150,0.5);
@Ugotsta
Ugotsta / fish_prompt.fish
Created Aug 30, 2018
Custom prompt for fish shell. Place in ~/.config/fish/functions
View fish_prompt.fish
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
Ugotsta / install-kitty.sh
Last active Aug 25, 2018
Installer script for Kitty terminal on elementary OS, or Ubuntu derivatives in general
View install-kitty.sh
#!/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 https://sw.kovidgoyal.net/kitty/binary.html#manually-installing
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
@Ugotsta
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
Ugotsta / vscode-snakecase-to-camelcase.md
Last active Feb 12, 2019
Convert all occurrences of snake_case to camelCase in VS Code. Windows/Linux walk-through here: https://youtu.be/vlHel1fN5_A
View vscode-snakecase-to-camelcase.md

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 ).
View vim-snakecase-to-camelcase.md

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.