Skip to content

Instantly share code, notes, and snippets.

View johansenja's full-sized avatar
🌱
Grazing

johansenja

🌱
Grazing
View GitHub Profile
@johansenja
johansenja / silent_background_process.vim
Created May 24, 2021 13:39
Run command in the background in vim
" I ended up using this for starting the long-running qdocs server in qdocs-vim (https://github.com/johansenja/qdocs-vim).
" Obviously this requires ruby to spawn the process, but that is ok here given that qdocs is written in ruby anyway
" spawn the process and grab the pid to be able to refer to later
" --disable=all just speeds up the ruby start time
let l:long_running_pid = system("ruby --disable=all -e 'print(spawn(%{long_running_shell_command}))'")
" stop the server using the pid from earlier
exe "! kill -9 " . l:long_running_pid
@johansenja
johansenja / getting_started.rb
Last active March 17, 2021 10:33
Enough Ruby to get started with Rails
#### Basic data types you need to know ####
nil
"String"
:Symbol # immutable; often used as identifiers for methods or properties, esp. as keys of hashes
1.is_a? Integer # true
1.0.is_a? Float # true
# Arrays:
my_array = []