Skip to content

Instantly share code, notes, and snippets.

View kkoomen's full-sized avatar

Kim 金可明 kkoomen

  • /dev/null
View GitHub Profile
@kkoomen
kkoomen / vim_command_php_convert_array_syntax.md
Last active August 17, 2019 16:05
Vim command to convert PHP syntax array() to []

Vim

Add the following to your .vimrc:

function s:PHPConvertArrays() abort
  let l:winview = winsaveview()
  while search('\m\(\w\)\@<!\carray\s*(') > 0
    call execute("normal! dt(%r]\<C-O>r[")
 endwhile
@kkoomen
kkoomen / vim-auto-plug-upgrade-every-week.md
Last active July 30, 2023 05:47
Vim-Plug: Run PlugUpdate every week automatically

This snippet will check every time you run Vim whether it updated all your Plug packages for you. It will do this once a week automatically for you.

Add the following to your .vimrc:

function! OnVimEnter() abort
  " Run PlugUpdate every week automatically when entering Vim.
  if exists('g:plug_home')
    let l:filename = printf('%s/.vim_plug_update', g:plug_home)
 if !filereadable(l:filename)
@kkoomen
kkoomen / raspberry_pi_3_vnc_osx_setup.sh
Last active December 16, 2019 14:43
Setup VNC on a Raspberry Pi 3 to enable screen sharing via OSX.
#!/usr/bin/env bash
#
# Thanks to:
# https://stackoverflow.com/questions/32361132/screen-sharing-between-raspberry-pi-and-mac-osx#32361133
#
# The NVC server will be available by default on: <raspberry ip>:5900.
# Connect from your Mac by opening Screen Sharing and then enter the Raspberry's ip.
# Install x11vnc.
sudo apt-get install x11vnc
@kkoomen
kkoomen / px-to-rem.sh
Last active January 12, 2019 15:43
Convert css pixel value to rem.
#!/usr/bin/env bash
#
# Convert all your "px" values to "rem" values. Supported filetypes can
# literally be anything, but just use extensions like:
# - file.css.less
# - file.less
# - file.css
# - file.scss
# - file.sass
#